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-Alpha2 candidate for devnets #1027

Open
wants to merge 189 commits into
base: v6.0.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
189 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
6abf794
Autolykos2PowValidation
kushti Apr 16, 2024
1d9f80a
powHit impl #1
kushti Apr 16, 2024
a67c6d6
powHit impl #1
kushti Apr 17, 2024
e1dcd4b
powHit impl #3 (Evaluate powHit test successfully executes)
kushti Apr 22, 2024
6d6404e
data for evaluate powhit test
kushti Apr 22, 2024
b4e2cc4
serialization roundtrip test
kushti Apr 23, 2024
9692241
bigint constructor
kushti Apr 23, 2024
af1b384
upcast test (to be moved into another branch)
kushti Apr 23, 2024
8f46b1b
powHit evaluation test
kushti Apr 23, 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
c526263
merging w. 6.0.0
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
35c9375
DataSerializer WIP #1
kushti May 16, 2024
48f11e7
coll allowed
kushti 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
3d47f2a
initial raw, buggy & unversioned unsigned bit int impl
kushti May 24, 2024
b13cef6
failing schnorr sig check w. unsigned
kushti May 24, 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
37b23cd
hit <= diff
kushti May 29, 2024
69e8d9e
merging w. 6.0.0
kushti May 29, 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
ac0ee15
merging w. 6.0.0
kushti Jun 5, 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
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
f7f31e3
fix w/out tests (only manual tests are done)
kushti Jun 13, 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
b7e2a38
first failing test
kushti Jun 19, 2024
828ba27
passing test from getVar from another input
kushti Jun 27, 2024
b80ef29
invalid tests
kushti Jun 28, 2024
6a3cbac
initial failing test & impl
kushti Jun 29, 2024
af92a3f
test passing
kushti Jun 29, 2024
fb3e52e
String fix & test
kushti Jul 17, 2024
ec215df
Array fix & test
kushti Jul 17, 2024
d257b5a
BigInteger and ErgoBox fix and tests
kushti Jul 17, 2024
1644380
AvlTreeData fix & test
kushti Jul 18, 2024
21d4bcf
merging w. 6.0.0, method desc
kushti Jul 29, 2024
27e2f52
powHit costing
kushti Jul 29, 2024
fdb4f6b
test in LSV6
kushti Jul 29, 2024
a8462fb
merging with Header.checkPoW
kushti Jul 29, 2024
a29a684
checks for k and N
kushti Jul 29, 2024
7016b2f
PowHitCostKind
kushti Jul 30, 2024
913cf28
compilation fix
kushti Jul 30, 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
2352bac
Merge branch 'i958-2' of github.com:ScorexFoundation/sigmastate-inter…
kushti Jul 31, 2024
5efda39
removing comma
kushti Jul 31, 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
3963ece
Merge branch 'i958-2' of github.com:ScorexFoundation/sigmastate-inter…
kushti Aug 2, 2024
2bf10bb
merging w. 6.0.0
kushti Aug 5, 2024
fb3c671
merging with i958-2
kushti Aug 7, 2024
0d3f4be
fixing and improving test, powHit version, tree version check
kushti Aug 7, 2024
f347dfd
fixed test in TestingSpecInterpreter
kushti Aug 7, 2024
57ba522
merging w. 6.0.0
kushti Aug 8, 2024
8da3575
fixed tests in LSV6
kushti Aug 9, 2024
26f92f1
merging w. 6.0.0
kushti Aug 12, 2024
12e888d
scala 2.11 compilation fix
kushti Aug 12, 2024
b0fbfbb
fixing getVar typing during tree building, simpler execution for getV…
kushti Aug 13, 2024
b4aa573
mmerging w. 6.0.0
kushti Aug 14, 2024
d8cc09d
deserializeCostKind
kushti Aug 14, 2024
57e39be
Header.bytes removed
kushti Aug 18, 2024
9e1498d
deserializeToBytes removed
kushti Aug 18, 2024
cd2eaee
LSV6 test, fixed deserializeTo description, polishing
kushti Aug 19, 2024
6bb7fe7
merging w. 6.0.0
kushti Aug 20, 2024
bcfb24d
removing unused CSigmaDslBuilder.validationSettings
kushti Aug 25, 2024
5f6a0d0
Merge branch 'v6.0.0' of github.com:ScorexFoundation/sigmastate-inter…
kushti Aug 26, 2024
5063bae
Merge branch 'v6.0.0' of github.com:ScorexFoundation/sigmastate-inter…
kushti Aug 27, 2024
dfedb4a
Merge branch 'i958-2' of github.com:ScorexFoundation/sigmastate-inter…
kushti Aug 30, 2024
9a10d17
merging w. i1006 (numeric methods)
kushti Sep 9, 2024
89d4477
Merge branch 'i1006' of github.com:ScorexFoundation/sigmastate-interp…
kushti Sep 12, 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
2bd556e
merging w. 6.0.0, fixed tests
kushti Sep 23, 2024
dfc448f
LSV6 test, roundtrip test, deserializeTo predefined function
kushti Sep 23, 2024
0ee89b1
improved scaladoc, removing unused new code in SigmaTyper
kushti Sep 23, 2024
67bda6b
2.11 compilation fixes
kushti Sep 24, 2024
a072123
improving tests
kushti Sep 24, 2024
cb9e9eb
fixing JS tests
kushti Sep 24, 2024
a1a66ad
trees in LSV6
kushti Sep 26, 2024
ed310bf
merging w. 6.0.0
kushti Sep 26, 2024
072d811
fix ErgoTreeSpecification
kushti Sep 27, 2024
8f45909
merging w 6.0.0
kushti Sep 27, 2024
ee35792
merging w. 6.0.0
kushti Sep 29, 2024
a3f25ef
LSV6 tests
kushti Sep 30, 2024
f24e9ad
predefined fn, LangSpec notes, polishing PR
kushti Sep 30, 2024
166c261
merging w. 6.0.0
kushti Sep 30, 2024
edc91ba
tests
kushti Sep 30, 2024
19a3e7f
Merge branch 'v6.0.0' of github.com:ScorexFoundation/sigmastate-inter…
kushti Sep 30, 2024
3901ba2
merging w. 6.0.0, Header support
kushti Sep 30, 2024
d0eef4c
merging w. 6.0.0
kushti Sep 30, 2024
6128fbd
fixing ErgoTreeSpec
kushti Oct 1, 2024
ee25e40
merging w. 6.0.0
kushti Oct 1, 2024
a49b2de
merging w. 6.0.0
kushti Oct 2, 2024
3c06856
Merge branch 'v6.0.0' of github.com:ScorexFoundation/sigmastate-inter…
kushti Oct 2, 2024
40fe947
versioned header check
kushti Oct 2, 2024
19c752d
fixing most of tests
kushti Oct 3, 2024
f77be78
fixing JS tests
kushti Oct 3, 2024
e052255
merging w. 6.0.0
kushti Oct 3, 2024
d8fab5e
Merge branch 'v6.0.0' of github.com:ScorexFoundation/sigmastate-inter…
kushti Oct 3, 2024
6c1ac1e
fix for AVLtreedata lift in JS
kushti Oct 3, 2024
4247cf0
post-merging fix of MethodCallSerializerSpecification
kushti Oct 3, 2024
f31e483
refined n & k values, polishing
kushti Oct 3, 2024
e71abfa
tree versioning artefact removed from test
kushti Oct 3, 2024
6b77c25
JS reflection for powHit_eval added
kushti Oct 3, 2024
ce11553
fixing JS reflection
kushti Oct 4, 2024
e4a611d
fixing MethodCallSerializerSpecification
kushti Oct 4, 2024
c5c37ff
fixing JS reflection
kushti Oct 4, 2024
bdaa884
fixing comp issue
kushti Oct 4, 2024
2a22f6d
fixing reflection data
kushti Oct 6, 2024
11d869f
merging w. 6.0.0
kushti Oct 7, 2024
08b02c7
initial some test passing
kushti Oct 7, 2024
2ba5a4f
PropertyCallSerializer fix, explicitTypeArgs fix, more tests
kushti Oct 8, 2024
29ed83a
Merge branch 'v6.0.0' of github.com:ScorexFoundation/sigmastate-inter…
kushti Oct 8, 2024
f151e1d
merging w. 6.0.0
kushti Oct 8, 2024
904e209
merging w. 6.0.0
kushti Oct 8, 2024
0aa88be
Merge branch 'v6.0.0' of github.com:ScorexFoundation/sigmastate-inter…
kushti Oct 8, 2024
e87ad02
Merge branch 'v6.0.0' of github.com:ScorexFoundation/sigmastate-inter…
kushti Oct 8, 2024
7b48ddd
merging w. 6.0.0
kushti Oct 8, 2024
e532630
fixing ErgoTreeSpecification
kushti Oct 8, 2024
7452f5f
JS reflection
kushti Oct 9, 2024
ba4b3b3
Merge branch 'i905' of github.com:ScorexFoundation/sigmastate-interpr…
kushti Oct 9, 2024
14db2e2
merging i978
kushti Oct 9, 2024
ef0e266
Merge branch 'i909' of github.com:ScorexFoundation/sigmastate-interpr…
kushti Oct 9, 2024
8d0d95f
merging i06
kushti Oct 9, 2024
611780f
merging i554
kushti Oct 9, 2024
5b3721e
merging 6.0-deserialize
kushti Oct 9, 2024
ae0a025
merging i958
kushti Oct 9, 2024
4b2b443
merging w. i675-2
kushti Oct 9, 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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*.fdb_latexmk
*.gz


yarn.lock
*.log
yarn.lock
Expand Down
1 change: 1 addition & 0 deletions core/jvm/src/main/scala/sigma/crypto/Platform.scala
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ object Platform {
case _: Int => tpe == SInt
case _: Long => tpe == SLong
case _: BigInt => tpe == SBigInt
case _: UnsignedBigInt => tpe == SUnsignedBigInt
case _: String => tpe == SString // TODO v6.0: remove this case (see https://github.com/ScorexFoundation/sigmastate-interpreter/issues/905)
case _: GroupElement => tpe.isGroupElement
case _: SigmaProp => tpe.isSigmaProp
Expand Down
2 changes: 2 additions & 0 deletions core/shared/src/main/scala/sigma/Evaluation.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ object Evaluation {
case SAny => AnyType
case SUnit => UnitType
case SBigInt => BigIntRType
case SUnsignedBigInt => UnsignedBigIntRType
case SBox => BoxRType
case SContext => ContextRType
case SGlobal => SigmaDslBuilderRType
Expand Down Expand Up @@ -67,6 +68,7 @@ object Evaluation {
case AnyType => SAny
case UnitType => SUnit
case BigIntRType => SBigInt
case UnsignedBigIntRType => SUnsignedBigInt
case GroupElementRType => SGroupElement
case AvlTreeRType => SAvlTree
case ot: OptionType[_] => SOption(rtypeToSType(ot.tA))
Expand Down
199 changes: 196 additions & 3 deletions core/shared/src/main/scala/sigma/SigmaDsl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import java.math.BigInteger
import sigma.data._

/**
* Functions defined for 256-bit signed integers
* */
* Base class for signed 256-bits integers
*/
trait BigInt {
/** Convert this BigInt value to Byte.
* @throws ArithmeticException if overflow happens.
Expand Down Expand Up @@ -169,8 +169,163 @@ trait BigInt {
* @return a 256-bit signed integer whose value is (this >> n). `n` should be in 0..255 range (inclusive).
*/
def shiftRight(n: Int): BigInt

/**
* @return unsigned representation of this BigInt, or exception if its value is negative
*/
def toUnsigned: UnsignedBigInt

/**
* @return unsigned representation of this BigInt modulo `m`. Cryptographic mod operation is done, ie result is
* non-negative always
*/
def toUnsignedMod(m: UnsignedBigInt): UnsignedBigInt
}


trait UnsignedBigInt {
/** Convert this BigInt value to Byte.
* @throws ArithmeticException if overflow happens.
*/
def toByte: Byte

/** Convert this BigInt value to Short.
* @throws ArithmeticException if overflow happens.
*/
def toShort: Short

/** Convert this BigInt value to Int.
* @throws ArithmeticException if overflow happens.
*/
def toInt: Int

/** Convert this BigInt value to Int.
* @throws ArithmeticException if overflow happens.
*/
def toLong: Long

/** Returns a big-endian representation of this BigInt in a collection of bytes.
* For example, the value {@code 0x1213141516171819} would yield the
* byte array {@code {0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19}}.
* @since 2.0
*/
def toBytes: Coll[Byte]


/** Compares this numeric with that numeric for order. Returns a negative integer, zero, or a positive integer as the
* `this` is less than, equal to, or greater than `that`.
*/
def compareTo(that: UnsignedBigInt): Int

/** Returns a BigInt whose value is {@code (this + that)}.
*
* @param that value to be added to this BigInt.
* @return { @code this + that}
*/
def add(that: UnsignedBigInt): UnsignedBigInt
def +(that: UnsignedBigInt): UnsignedBigInt = add(that)

/** Returns a BigInt whose value is {@code (this - that)}.
*
* @param that value to be subtracted from this BigInt.
* @return { @code this - that}
*/
def subtract(that: UnsignedBigInt): UnsignedBigInt

def -(that: UnsignedBigInt): UnsignedBigInt = subtract(that)

/** Returns a BigInt whose value is {@code (this * that)}.
*
* @implNote An implementation may offer better algorithmic
* performance when { @code that == this}.
* @param that value to be multiplied by this BigInt.
* @return { @code this * that}
*/
def multiply(that: UnsignedBigInt): UnsignedBigInt
def *(that: UnsignedBigInt): UnsignedBigInt = multiply(that)

/** Returns a BigInt whose value is {@code (this / that)}.
*
* @param that value by which this BigInt is to be divided.
* @return { @code this / that}
* @throws ArithmeticException if { @code that} is zero.
*/
def divide(that: UnsignedBigInt): UnsignedBigInt
def /(that: UnsignedBigInt): UnsignedBigInt = divide(that)

/**
* Returns a BigInt whose value is {@code (this mod m}). This method
* differs from {@code remainder} in that it always returns a
* <i>non-negative</i> BigInteger.
*
* @param m the modulus.
* @return { @code this mod m}
* @throws ArithmeticException { @code m} &le; 0
* @see #remainder
*/
def mod(m: UnsignedBigInt): UnsignedBigInt
def %(m: UnsignedBigInt): UnsignedBigInt = mod(m)

/**
* Returns the minimum of this BigInteger and {@code val}.
*
* @param that value with which the minimum is to be computed.
* @return the BigInteger whose value is the lesser of this BigInteger and
* { @code val}. If they are equal, either may be returned.
*/
def min(that: UnsignedBigInt): UnsignedBigInt

/**
* Returns the maximum of this BigInteger and {@code val}.
*
* @param that value with which the maximum is to be computed.
* @return the BigInteger whose value is the greater of this and
* { @code val}. If they are equal, either may be returned.
*/
def max(that: UnsignedBigInt): UnsignedBigInt

/** Returns a BigInteger whose value is `(this & that)`.
* @param that value to be AND'ed with this BigInteger.
* @return `this & that`
*/
def and(that: UnsignedBigInt): UnsignedBigInt
def &(that: UnsignedBigInt): UnsignedBigInt = and(that)

/** Returns a BigInteger whose value is `(this | that)`.
*
* @param that value to be OR'ed with this BigInteger.
* @return `this | that`
*/
def or(that: UnsignedBigInt): UnsignedBigInt
def |(that: UnsignedBigInt): UnsignedBigInt = or(that)

def modInverse(m: UnsignedBigInt): UnsignedBigInt
def plusMod(that: UnsignedBigInt, m: UnsignedBigInt): UnsignedBigInt
def subtractMod(that: UnsignedBigInt, m: UnsignedBigInt): UnsignedBigInt
def multiplyMod(that: UnsignedBigInt, m: UnsignedBigInt): UnsignedBigInt

/**
* @return a big integer whose value is `this xor that`
*/
def xor(that: UnsignedBigInt): UnsignedBigInt

/**
* @return a 256-bit signed integer whose value is (this << n). The shift distance, n, may be negative,
* in which case this method performs a right shift. (Computes floor(this * 2n).)
*/
def shiftLeft(n: Int): UnsignedBigInt

/**
* @return a 256-bit signed integer whose value is (this >> n). Sign extension is performed. The shift distance, n,
* may be negative, in which case this method performs a left shift. (Computes floor(this / 2n).)
*/
def shiftRight(n: Int): UnsignedBigInt

def toSigned(): BigInt
}



/** Base class for points on elliptic curves. */
trait GroupElement {
/** Checks if the provided element is an identity element. */
Expand All @@ -183,6 +338,8 @@ trait GroupElement {
*/
def exp(k: BigInt): GroupElement

def expUnsigned(k: UnsignedBigInt): GroupElement

/** Group operation. */
def multiply(that: GroupElement): GroupElement

Expand Down Expand Up @@ -490,7 +647,6 @@ trait Header {
* @return result of header's proof-of-work validation
*/
def checkPow: Boolean

}

/** Runtime representation of Context ErgoTree type.
Expand Down Expand Up @@ -589,6 +745,17 @@ trait Context {
*/
def getVar[T](id: Byte)(implicit cT: RType[T]): Option[T]

/**
* A variant of `getVar` to extract a context variable by id and type from any input
*
* @param inputId - input index
* @param id - context variable id
* @tparam T - expected type of the variable
* @return Some(value) if the variable is defined in the context AND has the given type.
* None otherwise
*/
def getVarFromInput[T](inputId: Short, id: Byte)(implicit cT: RType[T]): Option[T]

def vars: Coll[AnyValue]

/** Maximum version of ErgoTree currently activated on the network.
Expand Down Expand Up @@ -727,6 +894,20 @@ trait SigmaDslBuilder {
*/
def groupGenerator: GroupElement

/**
* @return big integer provided as input approximately encoded using NBits,
* see (https://bitcoin.stackexchange.com/questions/57184/what-does-the-nbits-value-represent)
* for format details
*/
def encodeNbits(bi: BigInt): Long

/**
* @return big integer decoded from NBits value provided,
* see (https://bitcoin.stackexchange.com/questions/57184/what-does-the-nbits-value-represent)
* for format details
*/
def decodeNbits(l: Long): BigInt

/**
* Transforms serialized bytes of ErgoTree with segregated constants by replacing constants
* at given positions with new values. This operation allow to use serialized scripts as
Expand All @@ -753,6 +934,8 @@ trait SigmaDslBuilder {
/** Create DSL big integer from existing `java.math.BigInteger`*/
def BigInt(n: BigInteger): BigInt

def UnsignedBigInt(n: BigInteger): UnsignedBigInt

/** Extract `java.math.BigInteger` from DSL's `BigInt` type*/
def toBigInteger(n: BigInt): BigInteger

Expand All @@ -765,7 +948,17 @@ trait SigmaDslBuilder {
/** Returns a byte-wise XOR of the two collections of bytes. */
def xor(l: Coll[Byte], r: Coll[Byte]): Coll[Byte]

/** Calculates value of a custom Autolykos 2 hash function */
def powHit(k: Int, msg: Coll[Byte], nonce: Coll[Byte], h: Coll[Byte], N: Int): BigInt

/** Deserializes provided `bytes` into a value of type `T`. **/
def deserializeTo[T](bytes: Coll[Byte])(implicit cT: RType[T]): T

/** Returns a number decoded from provided big-endian bytes array. */
def fromBigEndianBytes[T](bytes: Coll[Byte])(implicit cT: RType[T]): T

def some[T](value: T)(implicit cT: RType[T]): Option[T]

def none[T]()(implicit cT: RType[T]): Option[T]
}

Loading
Loading