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

Candidate for 6.0.0 release #930

Open
wants to merge 438 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
438 commits
Select commit Hold shift + click to select a range
11b9cf3
BigInt.down- and upcast to self fixed
kushti Jun 11, 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
a8234b9
review comments addressed
kushti Jun 12, 2024
7ccce9a
distinct and reverse (w. no costing)
kushti Jun 12, 2024
2fa224b
startsWith and endsWith
kushti Jun 12, 2024
b17c8c8
get
kushti Jun 12, 2024
fc3be57
non-execution of get_eval todo
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
62fd2a3
initial stub and roundtrip test with longToByteArray
kushti Jun 17, 2024
8bcc1ef
impl and tests done without costing etc
kushti Jun 18, 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
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
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
7f3a33c
extending tests in LanguageSpecificationV6
kushti Jul 24, 2024
271ec30
Merge pull request #1007 from ScorexFoundation/i877
kushti Jul 24, 2024
793af1b
merging w. 6.0
kushti Jul 26, 2024
1271a79
ScalaDoc for headerDecoder
kushti Jul 26, 2024
b677b18
merging w. i969
kushti Jul 26, 2024
e501a8b
polishing, LSV6 test
kushti Jul 26, 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
89f2df6
checkPoW added to collectMethods
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
ba878b8
fixing GraphIRReflection for checkPow, test for isoHeader for known v…
kushti Jul 31, 2024
b41d16c
test vectors for Blake2b256 and Long -> BigInt
kushti Jul 31, 2024
c2788b4
fixing checkPow test in JS
kushti Aug 1, 2024
26809c9
passing but improper changedFeature test
kushti Aug 2, 2024
eb219dd
merging w. 6.0.0
kushti Aug 2, 2024
bfd1049
yarn.lock added to .gitignore
kushti Aug 2, 2024
8133fad
yarn.lock removed
kushti Aug 2, 2024
6f509f9
Merge branch 'SethDusek-develop' into v6.0.0
kushti Aug 2, 2024
962a484
merging w. 6.0.0 , set tree size flag for trees v0 in SigmaDslTesting…
kushti Aug 3, 2024
04f6fee
test for substConstants with 5 elems
kushti Aug 4, 2024
f851b62
LSV5 fix
kushti Aug 5, 2024
3f7e784
Scala 2.11 compilation fix, ScalaDoc returned
kushti Aug 5, 2024
75a1fdb
Merge branch 'v6.0.0' of github.com:ScorexFoundation/sigmastate-inter…
kushti Aug 5, 2024
8b17643
fixed regression in CrossVersionProps
kushti Aug 5, 2024
b6aad2c
userDefinedInvoke ScalaDoc
kushti Aug 5, 2024
2a3c72d
Merge pull request #995 from ScorexFoundation/i994-fix-subst-constants
kushti Aug 5, 2024
17c3e6b
mrging w. 6.0.0
kushti Aug 5, 2024
2cfd2ff
Merge pull request #1002 from ScorexFoundation/v6.0-methodcall
kushti Aug 6, 2024
2e3db09
Merge branch 'v6.0.0' of github.com:ScorexFoundation/sigmastate-inter…
kushti Aug 6, 2024
e7fde10
versioned execution depending on tree version, newFeature test
kushti Aug 6, 2024
fed22d6
merging w. 6.0.0, AutolykosSolution eq and hashcode
kushti Aug 6, 2024
04eb6aa
Merge branch 'i969' of github.com:ScorexFoundation/sigmastate-interpr…
kushti Aug 6, 2024
57ba522
merging w. 6.0.0
kushti Aug 8, 2024
8da3575
fixed tests in LSV6
kushti Aug 9, 2024
ea0890b
tree versioning removed, scaladoc
kushti Aug 12, 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
65144a9
merging w. 6.0.0
kushti Aug 13, 2024
49a393c
merged w. 6.0.0
kushti Aug 19, 2024
649069b
fixed cost, improved args list for SigmaDslBuilder.fromBigEndianBytes
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
3037f1a
merging w 6.0.0, fixing ErgoTreeSpec
kushti Aug 27, 2024
016262b
removing unused SNumericTypeMethods.getMethods
kushti Aug 27, 2024
5063bae
Merge branch 'v6.0.0' of github.com:ScorexFoundation/sigmastate-inter…
kushti Aug 27, 2024
acb76c9
Merge branch 'v6.0.0' of github.com:ScorexFoundation/sigmastate-inter…
kushti Aug 27, 2024
877ed78
adding new methods to GraphIRReflection
kushti Aug 30, 2024
a988d90
Merge pull request #972 from ScorexFoundation/i969
kushti Sep 2, 2024
2cd57e1
Merge pull request #968 from ScorexFoundation/i958-2
kushti Sep 2, 2024
baef87f
more efficient toBits impl
kushti Sep 2, 2024
c7918ad
merging v6.0.0
kushti Sep 2, 2024
8208dd8
Box.getReg with computable index
kushti Sep 3, 2024
05c9e67
merging w. 6.0.0
kushti Sep 3, 2024
8e46b69
Merge pull request #1015 from ScorexFoundation/i416
kushti Sep 3, 2024
b068b10
Serialize SFunc in TypeSerializer
kushti Sep 3, 2024
1990030
Merge pull request #1020 from ScorexFoundation/i847
kushti Sep 3, 2024
5a983b3
merging w. 6.0.0
kushti Sep 3, 2024
2e8d8f4
optimizing imports, polishing
kushti Sep 3, 2024
d284f79
fixing post-merging failing test
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
f20635e
merging w v6.0.0
kushti Sep 13, 2024
7e3b676
fixing method calls check test
kushti Sep 16, 2024
55d03cd
addressing review comments
kushti Sep 16, 2024
4343bc9
fix for longToByteArray support in JS
kushti Sep 17, 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
5f0c5c5
scaladoc improvements, Ints.toBits
kushti Sep 20, 2024
3d88fc2
Merge pull request #1017 from ScorexFoundation/i1006
kushti Sep 20, 2024
9c310c7
merging w. 6.0.0
kushti Sep 20, 2024
f5feee5
Merge pull request #989 from ScorexFoundation/v6.0-serialize
kushti Sep 20, 2024
43db8df
scrypto 3.0.0
kushti Sep 23, 2024
9fd499a
merging w. 6.0.0
kushti Sep 24, 2024
8136c8f
new methods added to ReflectionData
kushti Sep 24, 2024
1999a2a
merging w. 6.0.0
kushti Sep 26, 2024
586aadd
LSV6 tests, predefined method
kushti Sep 26, 2024
2cdc34e
fixing JS tests
kushti Sep 26, 2024
d738ac5
fixing JS tests
kushti Sep 27, 2024
1989d19
LSV6 tests
kushti Sep 27, 2024
8f45909
merging w 6.0.0
kushti Sep 27, 2024
6459b07
fix ErgoTreeSpec
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
af792b5
addressing review comments
kushti Oct 1, 2024
6fa801c
Merge pull request #1013 from ScorexFoundation/i993
kushti Oct 1, 2024
ee25e40
merging w. 6.0.0
kushti Oct 1, 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
5c4ccf1
merging w. 6.0.0
kushti Oct 3, 2024
6c1ac1e
fix for AVLtreedata lift in JS
kushti Oct 3, 2024
e4a611d
fixing MethodCallSerializerSpecification
kushti Oct 4, 2024
c5c37ff
fixing JS reflection
kushti Oct 4, 2024
1d47d5f
addressing review comments
kushti Oct 7, 2024
83ba4a4
Merge pull request #1010 from ScorexFoundation/i1004
kushti Oct 7, 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
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
09ec5f1
ignoring bulletproof test, impoving comments
kushti Oct 18, 2024
5cabedd
equalsPairCollWithCollOverArray
kushti Oct 18, 2024
571e721
Merge pull request #1011 from ergoplatform/i909
kushti Oct 18, 2024
c21ed63
Merge pull request #1008 from ergoplatform/i906
kushti Oct 21, 2024
35fe87a
merging w. 6.0.0
kushti Oct 21, 2024
9036aec
improving tests in BasicOpsSpecification, type test for getVarFromInput
kushti Oct 21, 2024
8ae51e4
split in LSV6
kushti Oct 21, 2024
ceff4b2
Merge branch 'v6.0.0' of github.com:ScorexFoundation/sigmastate-inter…
kushti Oct 21, 2024
5f6b9ee
LSV6 tests
kushti Oct 22, 2024
03bfd6a
polishing
kushti Oct 22, 2024
1fbd4e5
Update docs/LangSpec.md
kushti Oct 24, 2024
208a191
Update docs/LangSpec.md
kushti Oct 24, 2024
b074b28
Merge pull request #1016 from ergoplatform/i978
kushti Oct 24, 2024
9d7962a
merging w. 6.0.0
kushti Oct 24, 2024
06fff23
merging w. 6.0.0
kushti Oct 24, 2024
a160997
UnsignedBigInt support in DataSerializerSpecification
kushti Oct 31, 2024
fdf712e
ErgoTreeSpecification update
kushti Oct 31, 2024
dde7f6e
fixing DataJsonEncoderSpecification
kushti Oct 31, 2024
a18967c
SigmaTyperTest fix
kushti Oct 31, 2024
2d8af9d
adding UnsignedBigInt to JS reflection , pt1
kushti Nov 1, 2024
933b2cc
improving UnsignedBigInt support in JS
kushti Nov 1, 2024
3a5c6d6
JS tests fixed
kushti Nov 4, 2024
b1d2b17
toUnsigned test in LSV6
kushti Nov 4, 2024
f84bce5
toUnsignedMod test in LSV6, more tests in BOS
kushti Nov 4, 2024
1496770
tests for .toBytes, UnsignedBigInt support added to to new Numeric me…
kushti Nov 5, 2024
ac4bbbc
unsigned encoding, .toBytes & .toBits tests passing
kushti Nov 5, 2024
a87bfb3
bitwiseInverse
kushti Nov 5, 2024
77be8a6
more .toBytes and .toBits tests
kushti Nov 11, 2024
626edc8
bitwise or/and/xor and tests
kushti Nov 11, 2024
aa246c3
shiftLeft/shiftRight and tests
kushti Nov 11, 2024
7fdcdbd
more tests for shiftLeft/shiftRight
kushti Nov 11, 2024
9566177
LSV6 tests for UnsignedBigInt
kushti Nov 13, 2024
503f0c7
bitwiseInverse fix, tests fixes
kushti Nov 13, 2024
6a15e5f
expUnsigned test
kushti Nov 13, 2024
b0e41a8
mod ops tests
kushti Nov 14, 2024
8da5f89
_eval mathods removed
kushti Nov 14, 2024
11bc3d0
More descriptions, some code cleaning
kushti Nov 14, 2024
8c5172b
costing
kushti Nov 14, 2024
dd33642
arith test
kushti Nov 14, 2024
8109a28
embeddable type list / serializers versioning, code cleaning , toUnsi…
kushti Nov 14, 2024
ae0421a
fixing JS test
kushti Nov 14, 2024
aa3fbbd
JS test comment
kushti Nov 14, 2024
cedcfbe
fixing tupleGen
kushti Nov 15, 2024
a66ab55
compilation err fix
kushti Nov 15, 2024
6d80439
merging w. 6.0.0
kushti Nov 18, 2024
20f68c0
decoding nbits from an Ergo block header
kushti Nov 18, 2024
e374229
LSV6 test
kushti Nov 18, 2024
eb50ab4
raising costs for encode/decode
kushti Nov 18, 2024
367d320
fixing cost comments
kushti Nov 19, 2024
494221a
Merge pull request #962 from ergoplatform/i675-2
kushti Nov 19, 2024
b0e7690
merging w. 6.0.0
kushti Nov 19, 2024
4c03c24
merging w. 6.0.0
kushti Nov 19, 2024
f195072
Global.deserializeTo[] method
kushti Nov 22, 2024
47b5558
Merge pull request #979 from ergoplatform/6.0-deserialize
kushti Nov 22, 2024
c0ea4b0
Autolykos 2 validation for custom message
kushti Nov 22, 2024
6d5a18b
Merge pull request #965 from ergoplatform/i958
kushti Nov 22, 2024
ee5fa99
merging w. 6.0.0
kushti Nov 22, 2024
46433f8
merging w. 6.0.0
kushti Nov 22, 2024
fa4b4b4
doc update
kushti Nov 22, 2024
f3e21b1
Merge pull request #1026 from ergoplatform/i462
kushti Nov 27, 2024
42d7fc7
merging w. 6.0.0
kushti Nov 27, 2024
912a523
Update core/js/src/main/scala/sigma/js/Type.scala
kushti Nov 29, 2024
0af752d
Update core/shared/src/main/scala/sigma/SigmaDsl.scala
kushti Nov 29, 2024
b545aa5
Update sc/shared/src/test/scala/sigmastate/ErgoTreeSpecification.scala
kushti Nov 29, 2024
ad3506e
addressing review comments
kushti Nov 29, 2024
847e4bb
Merge branch 'i554' of github.com:ScorexFoundation/sigmastate-interpr…
kushti Nov 29, 2024
469eab7
Merge branch 'v6.0.0' of github.com:ScorexFoundation/sigmastate-inter…
kushti Dec 4, 2024
b2ef5b5
Merge branch 'i554' of github.com:ScorexFoundation/sigmastate-interpr…
kushti Dec 4, 2024
326b315
UnsignedBigInt added to liftToConstant
kushti Dec 4, 2024
6e34213
versioning for SUnsignedBigInt check
kushti Dec 4, 2024
1969223
Merge pull request #997 from ergoplatform/i554
kushti Dec 4, 2024
780b28b
Merge branch 'v6.0.0' of github.com:ScorexFoundation/sigmastate-inter…
kushti Dec 4, 2024
38c2f63
Update interpreter/shared/src/test/scala/sigma/ast/SigmaBuilderTest.s…
kushti Dec 5, 2024
b85ba9c
cleared outdated comments in SigmaBuilderTest
kushti Dec 5, 2024
3952ab4
Merge branch 'i905' of github.com:ScorexFoundation/sigmastate-interpr…
kushti Dec 5, 2024
2ad87f4
PreHeader added
kushti Dec 5, 2024
d13dd4d
Merge pull request #1021 from ergoplatform/i905
kushti Dec 5, 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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
*.fdb_latexmk
*.gz

yarn.lock
*.log
yarn.lock
docs/spec/out/
test-out/
flamegraphs/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ This library is
on Maven repository and can be added to the SBT configuration of Scala project.

```scala
libraryDependencies += "org.scorexfoundation" %% "sigma-state" % "5.0.14"
libraryDependencies += "org.scorexfoundation" %% "sigma-state" % "6.0.0"
```

## Repository Organization
Expand Down
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ ThisBuild / dynverSeparator := "-"

val bouncycastleBcprov = "org.bouncycastle" % "bcprov-jdk15on" % "1.66"

val scrypto = "org.scorexfoundation" %% "scrypto" % "2.3.0-4-a0bc6176-SNAPSHOT"
val scrypto = "org.scorexfoundation" %% "scrypto" % "3.0.0"
val scryptoDependency =
libraryDependencies += "org.scorexfoundation" %%% "scrypto" % "2.3.0-4-a0bc6176-SNAPSHOT"
libraryDependencies += "org.scorexfoundation" %%% "scrypto" % "3.0.0"

val scorexUtil = "org.scorexfoundation" %% "scorex-util" % "0.2.1"
val scorexUtilDependency =
Expand Down
1 change: 1 addition & 0 deletions core/js/src/main/scala/sigma/crypto/Platform.scala
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ object Platform {
case _: Boolean => tpe == SBoolean
case _: Byte | _: Short | _: Int | _: Long => tpe.isInstanceOf[SNumericType]
case _: BigInt => tpe == SBigInt
case _: UnsignedBigInt => tpe == SUnsignedBigInt
case _: String => tpe == SString
case _: GroupElement => tpe.isGroupElement
case _: SigmaProp => tpe.isSigmaProp
Expand Down
4 changes: 2 additions & 2 deletions core/js/src/main/scala/sigma/js/GroupElement.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package sigma.js

import sigma.Extensions.CoreArrayByteOps
import scorex.util.encode.Base16
import sigma.crypto.{CryptoFacade, CryptoFacadeJs, Ecp, Platform}

import scala.scalajs.js
Expand All @@ -13,7 +13,7 @@ class GroupElement(val point: Ecp) extends js.Object {
* @see CryptoFacade.getASN1Encoding
*/
def toPointHex(): String = {
CryptoFacade.getASN1Encoding(point, true).toHex
Base16.encode(CryptoFacade.getASN1Encoding(point, true))
}
}

Expand Down
17 changes: 16 additions & 1 deletion core/js/src/main/scala/sigma/js/Isos.scala
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package sigma.js

import sigma.{Coll, Colls}
import sigma.data.{CBigInt, Iso, RType}
import sigma.data.{CBigInt, CUnsignedBigInt, Iso, RType}

import java.math.BigInteger
import scala.reflect.ClassTag
import scala.scalajs.js
import scala.scalajs.js.JSConverters.JSRichOption

/** Definitions of isomorphisms for sigma-core module.
* @see sigma.data.Iso
*/
object Isos {

implicit def isoUndefOr[A, B](implicit iso: Iso[A, B]): Iso[js.UndefOr[A], Option[B]] = new Iso[js.UndefOr[A], Option[B]] {
Expand Down Expand Up @@ -39,6 +42,18 @@ object Isos {
}
}

implicit val isoUnsignedBigInt: Iso[js.BigInt, sigma.UnsignedBigInt] = new Iso[js.BigInt, sigma.UnsignedBigInt] {
override def to(x: js.BigInt): sigma.UnsignedBigInt = {
CUnsignedBigInt(new BigInteger(x.toString(10)))
}

override def from(x: sigma.UnsignedBigInt): js.BigInt = {
val bi = x.asInstanceOf[CUnsignedBigInt].wrappedValue
val s = bi.toString(10)
js.BigInt(s)
}
}

implicit val isoBigIntToLong: Iso[js.BigInt, Long] = new Iso[js.BigInt, Long] {
override def to(x: js.BigInt): Long = java.lang.Long.parseLong(x.toString(10))

Expand Down
3 changes: 3 additions & 0 deletions core/js/src/main/scala/sigma/js/Type.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ object Type extends js.Object {
/** Descriptor of ErgoScript type BigInt. */
val BigInt = new Type(sigma.BigIntRType)

/** Descriptor of ErgoScript type UnsignedBigInt. */
val UnsignedBigInt = new Type(sigma.UnsignedBigIntRType)

/** Descriptor of ErgoScript type GroupElement. */
val GroupElement = new Type(sigma.GroupElementRType)

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
25 changes: 25 additions & 0 deletions core/shared/src/main/scala/sigma/Colls.scala
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ trait Coll[@specialized A] {
*/
def apply(i: Int): A

/** The element at given index or None if there is no such element. Indices start at `0`.
*
* @param i the index
* @return the element at the given index, or None if there is no such element
*/
def get(i: Int): Option[A] = {
if (isDefinedAt(i)) {
Some(apply(i))
} else {
None
}
}

/** Tests whether this $coll contains given index.
*
* The implementations of methods `apply` and `isDefinedAt` turn a `Coll[A]` into
Expand Down Expand Up @@ -76,6 +89,18 @@ trait Coll[@specialized A] {
* produces a collection ((x0, y0), ..., (xK, yK)) where K = min(N, M) */
def zip[@specialized B](ys: Coll[B]): Coll[(A, B)]

/**
* @return true if first elements of this collection form given `ys` collection, false otherwise.
* E.g. [1,2,3] starts with [1,2]
*/
def startsWith(ys: Coll[A]): Boolean

/**
* @return true if last elements of this collection form given `ys` collection, false otherwise.
* E.g. [1,2,3] ends with [2,3]
*/
def endsWith(ys: Coll[A]): Boolean

/** Tests whether a predicate holds for at least one element of this collection.
* @param p the predicate used to test elements.
* @return `true` if the given predicate `p` is satisfied by at least one element of this collection, otherwise `false`
Expand Down
2 changes: 1 addition & 1 deletion core/shared/src/main/scala/sigma/Environment.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sealed abstract class Environment {

object Environment {
/** Current runtime environment. */
implicit val current: Environment = new Environment {
val current: Environment = new Environment {
override def isJVM: Boolean = runtimePlatform == RuntimePlatform.JVM
override def isJS: Boolean = runtimePlatform == RuntimePlatform.JS
override def runtimePlatform: RuntimePlatform = sigma.reflection.Platform.runtimePlatform
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
5 changes: 0 additions & 5 deletions core/shared/src/main/scala/sigma/Extensions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ import sigma.data.RType
* See `implicit class ...` wrappers below.
*/
object Extensions {
/** Extension methods for `Array[Byte]` not available for generic `Array[T]`. */
implicit class CoreArrayByteOps(val arr: Array[Byte]) extends AnyVal {
/** Encodes array into hex string */
@inline def toHex: String = Base16.encode(arr)
}

/** Extension methods for `Array[T]` where implicit descriptor `RType[T]` is also
* required.
Expand Down
Loading
Loading