From 9c556375d946a2f350c7a7949b32b79615c13c3f Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Tue, 13 Jun 2023 12:16:28 +0200 Subject: [PATCH 01/58] compiler-js: setup crossProject for graph-ir module --- build.sbt | 52 +++++++++++++------ .../test/scala/scalan/BaseLiftableTests.scala | 0 .../src/test/scala/scalan/LibraryTests.scala | 0 .../src/test/scala/scalan/TestContexts.scala | 0 .../src/test/scala/scalan/TestLibrary.scala | 0 .../scalan/compilation/GraphVizExport.scala | 0 .../scala/scalan/util/ScalaNameUtil.scala | 0 .../scalan/util/ScalaNameUtilSuite.scala | 0 .../special/collections/BaseCostedTests.scala | 0 .../special/collections/BasicBenchmarks.scala | 0 .../special/collections/BenchmarkGens.scala | 0 .../special/collections/BufferBenchmark.scala | 0 .../special/collections/CollBenchmark.scala | 0 .../collections/CollsStagingTests.scala | 0 .../special/collections/MapBenchmark.scala | 0 .../special/collections/SymBenchmark.scala | 0 .../scala/special/wrappers/WOptionTests.scala | 0 .../scala/special/wrappers/WRTypeTests.scala | 0 .../wrappers/WSpecialPredefTests.scala | 0 .../special/wrappers/WrappersTests.scala | 0 .../src/main/resources/reference.conf | 0 .../src/main/scala/scalan/Base.scala | 0 .../src/main/scala/scalan/DefRewriting.scala | 0 .../src/main/scala/scalan/Entities.scala | 0 .../src/main/scala/scalan/Exceptions.scala | 0 .../main/scala/scalan/GraphIRReflection.scala | 0 .../src/main/scala/scalan/Library.scala | 0 .../src/main/scala/scalan/MethodCalls.scala | 0 .../src/main/scala/scalan/ModuleInfo.scala | 0 .../src/main/scala/scalan/Modules.scala | 0 .../src/main/scala/scalan/MutableLazy.scala | 0 .../src/main/scala/scalan/Scalan.scala | 0 .../src/main/scala/scalan/SigmaLibrary.scala | 0 .../src/main/scala/scalan/TypeDescs.scala | 0 .../src/main/scala/scalan/meta/SSymName.scala | 0 .../main/scala/scalan/primitives/Equal.scala | 0 .../scala/scalan/primitives/Functions.scala | 0 .../scala/scalan/primitives/IfThenElse.scala | 0 .../scala/scalan/primitives/LogicalOps.scala | 0 .../scala/scalan/primitives/NumericOps.scala | 0 .../scala/scalan/primitives/OrderingOps.scala | 0 .../main/scala/scalan/primitives/Thunks.scala | 0 .../main/scala/scalan/primitives/Tuples.scala | 0 .../scala/scalan/primitives/UnBinOps.scala | 0 .../scalan/primitives/UniversalOps.scala | 0 .../main/scala/scalan/staged/AstGraphs.scala | 0 .../scala/scalan/staged/ProgramGraphs.scala | 0 .../scala/scalan/staged/Transforming.scala | 0 .../src/main/scala/scalan/util/Variance.scala | 0 .../scala/special/collection/CollsUnit.scala | 0 .../special/collection/impl/CollsImpl.scala | 0 .../scala/special/sigma/SigmaDslUnit.scala | 0 .../special/sigma/impl/SigmaDslImpl.scala | 0 .../sigma/wrappers/WrappersModule.scala | 0 .../special/wrappers/WrappersModule.scala | 0 .../main/scala/wrappers/scala/WOptions.scala | 0 .../wrappers/scala/impl/WOptionsImpl.scala | 0 .../main/scala/wrappers/scalan/WRTypes.scala | 0 .../wrappers/scalan/impl/WRTypesImpl.scala | 0 .../wrappers/special/WSpecialPredefs.scala | 0 .../special/impl/WSpecialPredefsImpl.scala | 0 61 files changed, 36 insertions(+), 16 deletions(-) rename graph-ir/{ => jvm}/src/test/scala/scalan/BaseLiftableTests.scala (100%) rename graph-ir/{ => jvm}/src/test/scala/scalan/LibraryTests.scala (100%) rename graph-ir/{ => jvm}/src/test/scala/scalan/TestContexts.scala (100%) rename graph-ir/{ => jvm}/src/test/scala/scalan/TestLibrary.scala (100%) rename graph-ir/{ => jvm}/src/test/scala/scalan/compilation/GraphVizExport.scala (100%) rename graph-ir/{ => jvm}/src/test/scala/scalan/util/ScalaNameUtil.scala (100%) rename graph-ir/{ => jvm}/src/test/scala/scalan/util/ScalaNameUtilSuite.scala (100%) rename graph-ir/{ => jvm}/src/test/scala/special/collections/BaseCostedTests.scala (100%) rename graph-ir/{ => jvm}/src/test/scala/special/collections/BasicBenchmarks.scala (100%) rename graph-ir/{ => jvm}/src/test/scala/special/collections/BenchmarkGens.scala (100%) rename graph-ir/{ => jvm}/src/test/scala/special/collections/BufferBenchmark.scala (100%) rename graph-ir/{ => jvm}/src/test/scala/special/collections/CollBenchmark.scala (100%) rename graph-ir/{ => jvm}/src/test/scala/special/collections/CollsStagingTests.scala (100%) rename graph-ir/{ => jvm}/src/test/scala/special/collections/MapBenchmark.scala (100%) rename graph-ir/{ => jvm}/src/test/scala/special/collections/SymBenchmark.scala (100%) rename graph-ir/{ => jvm}/src/test/scala/special/wrappers/WOptionTests.scala (100%) rename graph-ir/{ => jvm}/src/test/scala/special/wrappers/WRTypeTests.scala (100%) rename graph-ir/{ => jvm}/src/test/scala/special/wrappers/WSpecialPredefTests.scala (100%) rename graph-ir/{ => jvm}/src/test/scala/special/wrappers/WrappersTests.scala (100%) rename graph-ir/{ => shared}/src/main/resources/reference.conf (100%) rename graph-ir/{ => shared}/src/main/scala/scalan/Base.scala (100%) rename graph-ir/{ => shared}/src/main/scala/scalan/DefRewriting.scala (100%) rename graph-ir/{ => shared}/src/main/scala/scalan/Entities.scala (100%) rename graph-ir/{ => shared}/src/main/scala/scalan/Exceptions.scala (100%) rename graph-ir/{ => shared}/src/main/scala/scalan/GraphIRReflection.scala (100%) rename graph-ir/{ => shared}/src/main/scala/scalan/Library.scala (100%) rename graph-ir/{ => shared}/src/main/scala/scalan/MethodCalls.scala (100%) rename graph-ir/{ => shared}/src/main/scala/scalan/ModuleInfo.scala (100%) rename graph-ir/{ => shared}/src/main/scala/scalan/Modules.scala (100%) rename graph-ir/{ => shared}/src/main/scala/scalan/MutableLazy.scala (100%) rename graph-ir/{ => shared}/src/main/scala/scalan/Scalan.scala (100%) rename graph-ir/{ => shared}/src/main/scala/scalan/SigmaLibrary.scala (100%) rename graph-ir/{ => shared}/src/main/scala/scalan/TypeDescs.scala (100%) rename graph-ir/{ => shared}/src/main/scala/scalan/meta/SSymName.scala (100%) rename graph-ir/{ => shared}/src/main/scala/scalan/primitives/Equal.scala (100%) rename graph-ir/{ => shared}/src/main/scala/scalan/primitives/Functions.scala (100%) rename graph-ir/{ => shared}/src/main/scala/scalan/primitives/IfThenElse.scala (100%) rename graph-ir/{ => shared}/src/main/scala/scalan/primitives/LogicalOps.scala (100%) rename graph-ir/{ => shared}/src/main/scala/scalan/primitives/NumericOps.scala (100%) rename graph-ir/{ => shared}/src/main/scala/scalan/primitives/OrderingOps.scala (100%) rename graph-ir/{ => shared}/src/main/scala/scalan/primitives/Thunks.scala (100%) rename graph-ir/{ => shared}/src/main/scala/scalan/primitives/Tuples.scala (100%) rename graph-ir/{ => shared}/src/main/scala/scalan/primitives/UnBinOps.scala (100%) rename graph-ir/{ => shared}/src/main/scala/scalan/primitives/UniversalOps.scala (100%) rename graph-ir/{ => shared}/src/main/scala/scalan/staged/AstGraphs.scala (100%) rename graph-ir/{ => shared}/src/main/scala/scalan/staged/ProgramGraphs.scala (100%) rename graph-ir/{ => shared}/src/main/scala/scalan/staged/Transforming.scala (100%) rename graph-ir/{ => shared}/src/main/scala/scalan/util/Variance.scala (100%) rename graph-ir/{ => shared}/src/main/scala/special/collection/CollsUnit.scala (100%) rename graph-ir/{ => shared}/src/main/scala/special/collection/impl/CollsImpl.scala (100%) rename graph-ir/{ => shared}/src/main/scala/special/sigma/SigmaDslUnit.scala (100%) rename graph-ir/{ => shared}/src/main/scala/special/sigma/impl/SigmaDslImpl.scala (100%) rename graph-ir/{ => shared}/src/main/scala/special/sigma/wrappers/WrappersModule.scala (100%) rename graph-ir/{ => shared}/src/main/scala/special/wrappers/WrappersModule.scala (100%) rename graph-ir/{ => shared}/src/main/scala/wrappers/scala/WOptions.scala (100%) rename graph-ir/{ => shared}/src/main/scala/wrappers/scala/impl/WOptionsImpl.scala (100%) rename graph-ir/{ => shared}/src/main/scala/wrappers/scalan/WRTypes.scala (100%) rename graph-ir/{ => shared}/src/main/scala/wrappers/scalan/impl/WRTypesImpl.scala (100%) rename graph-ir/{ => shared}/src/main/scala/wrappers/special/WSpecialPredefs.scala (100%) rename graph-ir/{ => shared}/src/main/scala/wrappers/special/impl/WSpecialPredefsImpl.scala (100%) diff --git a/build.sbt b/build.sbt index 9d95ffa3a2..5e7967ed0c 100644 --- a/build.sbt +++ b/build.sbt @@ -72,9 +72,9 @@ def javacReleaseOption = { } // suffix version with "-SNAPSHOT" for builds without a git tag -dynverSonatypeSnapshots in ThisBuild := true +ThisBuild / dynverSonatypeSnapshots := true // use "-" instead of default "+" -dynverSeparator in ThisBuild := "-" +ThisBuild / dynverSeparator := "-" val bouncycastleBcprov = "org.bouncycastle" % "bcprov-jdk15on" % "1.66" @@ -125,13 +125,17 @@ def circeDependency = { } } +lazy val scalatest = "org.scalatest" %% "scalatest" % "3.2.14" % Test +lazy val scalactic = "org.scalactic" %% "scalactic" % "3.2.14" % Test +lazy val pprint = "com.lihaoyi" %% "pprint" % "0.6.3" % Test +lazy val scalameter = "com.storm-enroute" %% "scalameter" % "0.19" % Test + lazy val testingDependencies = Seq( - "org.scalatest" %% "scalatest" % "3.2.14" % Test, - "org.scalactic" %% "scalactic" % "3.2.14" % Test, + scalatest, scalactic, "org.scalacheck" %% "scalacheck" % "1.15.2" % Test, // last supporting Scala 2.11 "org.scalatestplus" %% "scalacheck-1-15" % "3.2.3.0" % Test, // last supporting Scala 2.11 - "com.lihaoyi" %% "pprint" % "0.6.3" % Test, - "com.storm-enroute" %% "scalameter" % "0.19" % Test + pprint, + scalameter ) lazy val testingDependencies2 = @@ -162,8 +166,8 @@ lazy val testSettings2 = Seq( scalacOptions ++= Seq("-feature", "-deprecation") -parallelExecution in Test := false -publishArtifact in Test := true +Test / parallelExecution := false +Test / publishArtifact := true pomIncludeRepository := { _ => false } @@ -218,12 +222,24 @@ lazy val corelib = crossProject(JVMPlatform, JSPlatform) lazy val corelibJS = corelib.js .enablePlugins(ScalaJSBundlerPlugin) -lazy val graphir = Project("graph-ir", file("graph-ir")) - .dependsOn(common.jvm % allConfigDependency, corelib.jvm % allConfigDependency) +lazy val graphir = crossProject(JVMPlatform, JSPlatform) + .in(file("graph-ir")) + .dependsOn(common % allConfigDependency, corelib % allConfigDependency) .settings( - libraryDefSettings, - libraryDependencies ++= Seq( debox, scrypto, bouncycastleBcprov )) - .settings(publish / skip := true) + commonDependenies2, + scryptoDependency, + publish / skip := true + ) + .jvmSettings( + crossScalaSettings, + libraryDependencies ++= Seq(scalameter) + ) + .jsSettings( + crossScalaSettingsJS, + useYarn := true + ) +lazy val graphirJS = graphir.js + .enablePlugins(ScalaJSBundlerPlugin) lazy val interpreter = crossProject(JVMPlatform, JSPlatform) .in(file("interpreter")) @@ -278,7 +294,11 @@ lazy val parsersJS = parsers.js .enablePlugins(ScalaJSBundlerPlugin) lazy val sc = (project in file("sc")) - .dependsOn(graphir % allConfigDependency, interpreter.jvm % allConfigDependency, parsers.jvm % allConfigDependency) + .dependsOn( + graphir.jvm % allConfigDependency, + interpreter.jvm % allConfigDependency, + parsers.jvm % allConfigDependency + ) .settings(libraryDefSettings) .settings(libraryDependencies ++= Seq(scorexUtil, fastparse) ++ circeDeps(scalaVersion.value) @@ -317,13 +337,13 @@ lazy val sdkJS = sdk.js ) lazy val sigma = (project in file(".")) - .aggregate(common.jvm, corelib.jvm, graphir, interpreter.jvm, parsers.jvm, sc, sdk.jvm) + .aggregate(common.jvm, corelib.jvm, graphir.jvm, interpreter.jvm, parsers.jvm, sc, sdk.jvm) .settings(libraryDefSettings, rootSettings) .settings(publish / aggregate := false) .settings(publishLocal / aggregate := false) lazy val aggregateCompile = ScopeFilter( - inProjects(common.jvm, corelib.jvm, graphir, interpreter.jvm, parsers.jvm, sc, sdk.jvm), + inProjects(common.jvm, corelib.jvm, graphir.jvm, interpreter.jvm, parsers.jvm, sc, sdk.jvm), inConfigurations(Compile)) lazy val rootSettings = Seq( diff --git a/graph-ir/src/test/scala/scalan/BaseLiftableTests.scala b/graph-ir/jvm/src/test/scala/scalan/BaseLiftableTests.scala similarity index 100% rename from graph-ir/src/test/scala/scalan/BaseLiftableTests.scala rename to graph-ir/jvm/src/test/scala/scalan/BaseLiftableTests.scala diff --git a/graph-ir/src/test/scala/scalan/LibraryTests.scala b/graph-ir/jvm/src/test/scala/scalan/LibraryTests.scala similarity index 100% rename from graph-ir/src/test/scala/scalan/LibraryTests.scala rename to graph-ir/jvm/src/test/scala/scalan/LibraryTests.scala diff --git a/graph-ir/src/test/scala/scalan/TestContexts.scala b/graph-ir/jvm/src/test/scala/scalan/TestContexts.scala similarity index 100% rename from graph-ir/src/test/scala/scalan/TestContexts.scala rename to graph-ir/jvm/src/test/scala/scalan/TestContexts.scala diff --git a/graph-ir/src/test/scala/scalan/TestLibrary.scala b/graph-ir/jvm/src/test/scala/scalan/TestLibrary.scala similarity index 100% rename from graph-ir/src/test/scala/scalan/TestLibrary.scala rename to graph-ir/jvm/src/test/scala/scalan/TestLibrary.scala diff --git a/graph-ir/src/test/scala/scalan/compilation/GraphVizExport.scala b/graph-ir/jvm/src/test/scala/scalan/compilation/GraphVizExport.scala similarity index 100% rename from graph-ir/src/test/scala/scalan/compilation/GraphVizExport.scala rename to graph-ir/jvm/src/test/scala/scalan/compilation/GraphVizExport.scala diff --git a/graph-ir/src/test/scala/scalan/util/ScalaNameUtil.scala b/graph-ir/jvm/src/test/scala/scalan/util/ScalaNameUtil.scala similarity index 100% rename from graph-ir/src/test/scala/scalan/util/ScalaNameUtil.scala rename to graph-ir/jvm/src/test/scala/scalan/util/ScalaNameUtil.scala diff --git a/graph-ir/src/test/scala/scalan/util/ScalaNameUtilSuite.scala b/graph-ir/jvm/src/test/scala/scalan/util/ScalaNameUtilSuite.scala similarity index 100% rename from graph-ir/src/test/scala/scalan/util/ScalaNameUtilSuite.scala rename to graph-ir/jvm/src/test/scala/scalan/util/ScalaNameUtilSuite.scala diff --git a/graph-ir/src/test/scala/special/collections/BaseCostedTests.scala b/graph-ir/jvm/src/test/scala/special/collections/BaseCostedTests.scala similarity index 100% rename from graph-ir/src/test/scala/special/collections/BaseCostedTests.scala rename to graph-ir/jvm/src/test/scala/special/collections/BaseCostedTests.scala diff --git a/graph-ir/src/test/scala/special/collections/BasicBenchmarks.scala b/graph-ir/jvm/src/test/scala/special/collections/BasicBenchmarks.scala similarity index 100% rename from graph-ir/src/test/scala/special/collections/BasicBenchmarks.scala rename to graph-ir/jvm/src/test/scala/special/collections/BasicBenchmarks.scala diff --git a/graph-ir/src/test/scala/special/collections/BenchmarkGens.scala b/graph-ir/jvm/src/test/scala/special/collections/BenchmarkGens.scala similarity index 100% rename from graph-ir/src/test/scala/special/collections/BenchmarkGens.scala rename to graph-ir/jvm/src/test/scala/special/collections/BenchmarkGens.scala diff --git a/graph-ir/src/test/scala/special/collections/BufferBenchmark.scala b/graph-ir/jvm/src/test/scala/special/collections/BufferBenchmark.scala similarity index 100% rename from graph-ir/src/test/scala/special/collections/BufferBenchmark.scala rename to graph-ir/jvm/src/test/scala/special/collections/BufferBenchmark.scala diff --git a/graph-ir/src/test/scala/special/collections/CollBenchmark.scala b/graph-ir/jvm/src/test/scala/special/collections/CollBenchmark.scala similarity index 100% rename from graph-ir/src/test/scala/special/collections/CollBenchmark.scala rename to graph-ir/jvm/src/test/scala/special/collections/CollBenchmark.scala diff --git a/graph-ir/src/test/scala/special/collections/CollsStagingTests.scala b/graph-ir/jvm/src/test/scala/special/collections/CollsStagingTests.scala similarity index 100% rename from graph-ir/src/test/scala/special/collections/CollsStagingTests.scala rename to graph-ir/jvm/src/test/scala/special/collections/CollsStagingTests.scala diff --git a/graph-ir/src/test/scala/special/collections/MapBenchmark.scala b/graph-ir/jvm/src/test/scala/special/collections/MapBenchmark.scala similarity index 100% rename from graph-ir/src/test/scala/special/collections/MapBenchmark.scala rename to graph-ir/jvm/src/test/scala/special/collections/MapBenchmark.scala diff --git a/graph-ir/src/test/scala/special/collections/SymBenchmark.scala b/graph-ir/jvm/src/test/scala/special/collections/SymBenchmark.scala similarity index 100% rename from graph-ir/src/test/scala/special/collections/SymBenchmark.scala rename to graph-ir/jvm/src/test/scala/special/collections/SymBenchmark.scala diff --git a/graph-ir/src/test/scala/special/wrappers/WOptionTests.scala b/graph-ir/jvm/src/test/scala/special/wrappers/WOptionTests.scala similarity index 100% rename from graph-ir/src/test/scala/special/wrappers/WOptionTests.scala rename to graph-ir/jvm/src/test/scala/special/wrappers/WOptionTests.scala diff --git a/graph-ir/src/test/scala/special/wrappers/WRTypeTests.scala b/graph-ir/jvm/src/test/scala/special/wrappers/WRTypeTests.scala similarity index 100% rename from graph-ir/src/test/scala/special/wrappers/WRTypeTests.scala rename to graph-ir/jvm/src/test/scala/special/wrappers/WRTypeTests.scala diff --git a/graph-ir/src/test/scala/special/wrappers/WSpecialPredefTests.scala b/graph-ir/jvm/src/test/scala/special/wrappers/WSpecialPredefTests.scala similarity index 100% rename from graph-ir/src/test/scala/special/wrappers/WSpecialPredefTests.scala rename to graph-ir/jvm/src/test/scala/special/wrappers/WSpecialPredefTests.scala diff --git a/graph-ir/src/test/scala/special/wrappers/WrappersTests.scala b/graph-ir/jvm/src/test/scala/special/wrappers/WrappersTests.scala similarity index 100% rename from graph-ir/src/test/scala/special/wrappers/WrappersTests.scala rename to graph-ir/jvm/src/test/scala/special/wrappers/WrappersTests.scala diff --git a/graph-ir/src/main/resources/reference.conf b/graph-ir/shared/src/main/resources/reference.conf similarity index 100% rename from graph-ir/src/main/resources/reference.conf rename to graph-ir/shared/src/main/resources/reference.conf diff --git a/graph-ir/src/main/scala/scalan/Base.scala b/graph-ir/shared/src/main/scala/scalan/Base.scala similarity index 100% rename from graph-ir/src/main/scala/scalan/Base.scala rename to graph-ir/shared/src/main/scala/scalan/Base.scala diff --git a/graph-ir/src/main/scala/scalan/DefRewriting.scala b/graph-ir/shared/src/main/scala/scalan/DefRewriting.scala similarity index 100% rename from graph-ir/src/main/scala/scalan/DefRewriting.scala rename to graph-ir/shared/src/main/scala/scalan/DefRewriting.scala diff --git a/graph-ir/src/main/scala/scalan/Entities.scala b/graph-ir/shared/src/main/scala/scalan/Entities.scala similarity index 100% rename from graph-ir/src/main/scala/scalan/Entities.scala rename to graph-ir/shared/src/main/scala/scalan/Entities.scala diff --git a/graph-ir/src/main/scala/scalan/Exceptions.scala b/graph-ir/shared/src/main/scala/scalan/Exceptions.scala similarity index 100% rename from graph-ir/src/main/scala/scalan/Exceptions.scala rename to graph-ir/shared/src/main/scala/scalan/Exceptions.scala diff --git a/graph-ir/src/main/scala/scalan/GraphIRReflection.scala b/graph-ir/shared/src/main/scala/scalan/GraphIRReflection.scala similarity index 100% rename from graph-ir/src/main/scala/scalan/GraphIRReflection.scala rename to graph-ir/shared/src/main/scala/scalan/GraphIRReflection.scala diff --git a/graph-ir/src/main/scala/scalan/Library.scala b/graph-ir/shared/src/main/scala/scalan/Library.scala similarity index 100% rename from graph-ir/src/main/scala/scalan/Library.scala rename to graph-ir/shared/src/main/scala/scalan/Library.scala diff --git a/graph-ir/src/main/scala/scalan/MethodCalls.scala b/graph-ir/shared/src/main/scala/scalan/MethodCalls.scala similarity index 100% rename from graph-ir/src/main/scala/scalan/MethodCalls.scala rename to graph-ir/shared/src/main/scala/scalan/MethodCalls.scala diff --git a/graph-ir/src/main/scala/scalan/ModuleInfo.scala b/graph-ir/shared/src/main/scala/scalan/ModuleInfo.scala similarity index 100% rename from graph-ir/src/main/scala/scalan/ModuleInfo.scala rename to graph-ir/shared/src/main/scala/scalan/ModuleInfo.scala diff --git a/graph-ir/src/main/scala/scalan/Modules.scala b/graph-ir/shared/src/main/scala/scalan/Modules.scala similarity index 100% rename from graph-ir/src/main/scala/scalan/Modules.scala rename to graph-ir/shared/src/main/scala/scalan/Modules.scala diff --git a/graph-ir/src/main/scala/scalan/MutableLazy.scala b/graph-ir/shared/src/main/scala/scalan/MutableLazy.scala similarity index 100% rename from graph-ir/src/main/scala/scalan/MutableLazy.scala rename to graph-ir/shared/src/main/scala/scalan/MutableLazy.scala diff --git a/graph-ir/src/main/scala/scalan/Scalan.scala b/graph-ir/shared/src/main/scala/scalan/Scalan.scala similarity index 100% rename from graph-ir/src/main/scala/scalan/Scalan.scala rename to graph-ir/shared/src/main/scala/scalan/Scalan.scala diff --git a/graph-ir/src/main/scala/scalan/SigmaLibrary.scala b/graph-ir/shared/src/main/scala/scalan/SigmaLibrary.scala similarity index 100% rename from graph-ir/src/main/scala/scalan/SigmaLibrary.scala rename to graph-ir/shared/src/main/scala/scalan/SigmaLibrary.scala diff --git a/graph-ir/src/main/scala/scalan/TypeDescs.scala b/graph-ir/shared/src/main/scala/scalan/TypeDescs.scala similarity index 100% rename from graph-ir/src/main/scala/scalan/TypeDescs.scala rename to graph-ir/shared/src/main/scala/scalan/TypeDescs.scala diff --git a/graph-ir/src/main/scala/scalan/meta/SSymName.scala b/graph-ir/shared/src/main/scala/scalan/meta/SSymName.scala similarity index 100% rename from graph-ir/src/main/scala/scalan/meta/SSymName.scala rename to graph-ir/shared/src/main/scala/scalan/meta/SSymName.scala diff --git a/graph-ir/src/main/scala/scalan/primitives/Equal.scala b/graph-ir/shared/src/main/scala/scalan/primitives/Equal.scala similarity index 100% rename from graph-ir/src/main/scala/scalan/primitives/Equal.scala rename to graph-ir/shared/src/main/scala/scalan/primitives/Equal.scala diff --git a/graph-ir/src/main/scala/scalan/primitives/Functions.scala b/graph-ir/shared/src/main/scala/scalan/primitives/Functions.scala similarity index 100% rename from graph-ir/src/main/scala/scalan/primitives/Functions.scala rename to graph-ir/shared/src/main/scala/scalan/primitives/Functions.scala diff --git a/graph-ir/src/main/scala/scalan/primitives/IfThenElse.scala b/graph-ir/shared/src/main/scala/scalan/primitives/IfThenElse.scala similarity index 100% rename from graph-ir/src/main/scala/scalan/primitives/IfThenElse.scala rename to graph-ir/shared/src/main/scala/scalan/primitives/IfThenElse.scala diff --git a/graph-ir/src/main/scala/scalan/primitives/LogicalOps.scala b/graph-ir/shared/src/main/scala/scalan/primitives/LogicalOps.scala similarity index 100% rename from graph-ir/src/main/scala/scalan/primitives/LogicalOps.scala rename to graph-ir/shared/src/main/scala/scalan/primitives/LogicalOps.scala diff --git a/graph-ir/src/main/scala/scalan/primitives/NumericOps.scala b/graph-ir/shared/src/main/scala/scalan/primitives/NumericOps.scala similarity index 100% rename from graph-ir/src/main/scala/scalan/primitives/NumericOps.scala rename to graph-ir/shared/src/main/scala/scalan/primitives/NumericOps.scala diff --git a/graph-ir/src/main/scala/scalan/primitives/OrderingOps.scala b/graph-ir/shared/src/main/scala/scalan/primitives/OrderingOps.scala similarity index 100% rename from graph-ir/src/main/scala/scalan/primitives/OrderingOps.scala rename to graph-ir/shared/src/main/scala/scalan/primitives/OrderingOps.scala diff --git a/graph-ir/src/main/scala/scalan/primitives/Thunks.scala b/graph-ir/shared/src/main/scala/scalan/primitives/Thunks.scala similarity index 100% rename from graph-ir/src/main/scala/scalan/primitives/Thunks.scala rename to graph-ir/shared/src/main/scala/scalan/primitives/Thunks.scala diff --git a/graph-ir/src/main/scala/scalan/primitives/Tuples.scala b/graph-ir/shared/src/main/scala/scalan/primitives/Tuples.scala similarity index 100% rename from graph-ir/src/main/scala/scalan/primitives/Tuples.scala rename to graph-ir/shared/src/main/scala/scalan/primitives/Tuples.scala diff --git a/graph-ir/src/main/scala/scalan/primitives/UnBinOps.scala b/graph-ir/shared/src/main/scala/scalan/primitives/UnBinOps.scala similarity index 100% rename from graph-ir/src/main/scala/scalan/primitives/UnBinOps.scala rename to graph-ir/shared/src/main/scala/scalan/primitives/UnBinOps.scala diff --git a/graph-ir/src/main/scala/scalan/primitives/UniversalOps.scala b/graph-ir/shared/src/main/scala/scalan/primitives/UniversalOps.scala similarity index 100% rename from graph-ir/src/main/scala/scalan/primitives/UniversalOps.scala rename to graph-ir/shared/src/main/scala/scalan/primitives/UniversalOps.scala diff --git a/graph-ir/src/main/scala/scalan/staged/AstGraphs.scala b/graph-ir/shared/src/main/scala/scalan/staged/AstGraphs.scala similarity index 100% rename from graph-ir/src/main/scala/scalan/staged/AstGraphs.scala rename to graph-ir/shared/src/main/scala/scalan/staged/AstGraphs.scala diff --git a/graph-ir/src/main/scala/scalan/staged/ProgramGraphs.scala b/graph-ir/shared/src/main/scala/scalan/staged/ProgramGraphs.scala similarity index 100% rename from graph-ir/src/main/scala/scalan/staged/ProgramGraphs.scala rename to graph-ir/shared/src/main/scala/scalan/staged/ProgramGraphs.scala diff --git a/graph-ir/src/main/scala/scalan/staged/Transforming.scala b/graph-ir/shared/src/main/scala/scalan/staged/Transforming.scala similarity index 100% rename from graph-ir/src/main/scala/scalan/staged/Transforming.scala rename to graph-ir/shared/src/main/scala/scalan/staged/Transforming.scala diff --git a/graph-ir/src/main/scala/scalan/util/Variance.scala b/graph-ir/shared/src/main/scala/scalan/util/Variance.scala similarity index 100% rename from graph-ir/src/main/scala/scalan/util/Variance.scala rename to graph-ir/shared/src/main/scala/scalan/util/Variance.scala diff --git a/graph-ir/src/main/scala/special/collection/CollsUnit.scala b/graph-ir/shared/src/main/scala/special/collection/CollsUnit.scala similarity index 100% rename from graph-ir/src/main/scala/special/collection/CollsUnit.scala rename to graph-ir/shared/src/main/scala/special/collection/CollsUnit.scala diff --git a/graph-ir/src/main/scala/special/collection/impl/CollsImpl.scala b/graph-ir/shared/src/main/scala/special/collection/impl/CollsImpl.scala similarity index 100% rename from graph-ir/src/main/scala/special/collection/impl/CollsImpl.scala rename to graph-ir/shared/src/main/scala/special/collection/impl/CollsImpl.scala diff --git a/graph-ir/src/main/scala/special/sigma/SigmaDslUnit.scala b/graph-ir/shared/src/main/scala/special/sigma/SigmaDslUnit.scala similarity index 100% rename from graph-ir/src/main/scala/special/sigma/SigmaDslUnit.scala rename to graph-ir/shared/src/main/scala/special/sigma/SigmaDslUnit.scala diff --git a/graph-ir/src/main/scala/special/sigma/impl/SigmaDslImpl.scala b/graph-ir/shared/src/main/scala/special/sigma/impl/SigmaDslImpl.scala similarity index 100% rename from graph-ir/src/main/scala/special/sigma/impl/SigmaDslImpl.scala rename to graph-ir/shared/src/main/scala/special/sigma/impl/SigmaDslImpl.scala diff --git a/graph-ir/src/main/scala/special/sigma/wrappers/WrappersModule.scala b/graph-ir/shared/src/main/scala/special/sigma/wrappers/WrappersModule.scala similarity index 100% rename from graph-ir/src/main/scala/special/sigma/wrappers/WrappersModule.scala rename to graph-ir/shared/src/main/scala/special/sigma/wrappers/WrappersModule.scala diff --git a/graph-ir/src/main/scala/special/wrappers/WrappersModule.scala b/graph-ir/shared/src/main/scala/special/wrappers/WrappersModule.scala similarity index 100% rename from graph-ir/src/main/scala/special/wrappers/WrappersModule.scala rename to graph-ir/shared/src/main/scala/special/wrappers/WrappersModule.scala diff --git a/graph-ir/src/main/scala/wrappers/scala/WOptions.scala b/graph-ir/shared/src/main/scala/wrappers/scala/WOptions.scala similarity index 100% rename from graph-ir/src/main/scala/wrappers/scala/WOptions.scala rename to graph-ir/shared/src/main/scala/wrappers/scala/WOptions.scala diff --git a/graph-ir/src/main/scala/wrappers/scala/impl/WOptionsImpl.scala b/graph-ir/shared/src/main/scala/wrappers/scala/impl/WOptionsImpl.scala similarity index 100% rename from graph-ir/src/main/scala/wrappers/scala/impl/WOptionsImpl.scala rename to graph-ir/shared/src/main/scala/wrappers/scala/impl/WOptionsImpl.scala diff --git a/graph-ir/src/main/scala/wrappers/scalan/WRTypes.scala b/graph-ir/shared/src/main/scala/wrappers/scalan/WRTypes.scala similarity index 100% rename from graph-ir/src/main/scala/wrappers/scalan/WRTypes.scala rename to graph-ir/shared/src/main/scala/wrappers/scalan/WRTypes.scala diff --git a/graph-ir/src/main/scala/wrappers/scalan/impl/WRTypesImpl.scala b/graph-ir/shared/src/main/scala/wrappers/scalan/impl/WRTypesImpl.scala similarity index 100% rename from graph-ir/src/main/scala/wrappers/scalan/impl/WRTypesImpl.scala rename to graph-ir/shared/src/main/scala/wrappers/scalan/impl/WRTypesImpl.scala diff --git a/graph-ir/src/main/scala/wrappers/special/WSpecialPredefs.scala b/graph-ir/shared/src/main/scala/wrappers/special/WSpecialPredefs.scala similarity index 100% rename from graph-ir/src/main/scala/wrappers/special/WSpecialPredefs.scala rename to graph-ir/shared/src/main/scala/wrappers/special/WSpecialPredefs.scala diff --git a/graph-ir/src/main/scala/wrappers/special/impl/WSpecialPredefsImpl.scala b/graph-ir/shared/src/main/scala/wrappers/special/impl/WSpecialPredefsImpl.scala similarity index 100% rename from graph-ir/src/main/scala/wrappers/special/impl/WSpecialPredefsImpl.scala rename to graph-ir/shared/src/main/scala/wrappers/special/impl/WSpecialPredefsImpl.scala From 16eb500b56c3f455d4488484714121c624be2486 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Tue, 13 Jun 2023 19:21:19 +0200 Subject: [PATCH 02/58] compiler-js: drop Scala 2.12 for JS --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 5e7967ed0c..5f07f92dd2 100644 --- a/build.sbt +++ b/build.sbt @@ -59,7 +59,7 @@ lazy val crossScalaSettings = Seq( scalaVersion := scala213 ) lazy val crossScalaSettingsJS = Seq( - crossScalaVersions := Seq(scala213, scala212), + crossScalaVersions := Seq(scala213), scalaVersion := scala213 ) From 8501776f22fe891801fe54f189fe4658abd426ad Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Tue, 13 Jun 2023 19:29:54 +0200 Subject: [PATCH 03/58] compiler-js: introduce scalan.reflection.Platform and fix JS compilation --- .../scala/scalan/reflection/Platform.scala | 5 +++ .../scala/scalan/reflection/Platform.scala | 18 ++++++++++ .../scala/scalan/util/ReflectionUtil.scala | 24 +++---------- .../js/src/test/scala/scalan/Platform.scala | 13 +++++++ .../jvm/src/test/scala/scalan/Platform.scala | 34 +++++++++++++++++++ .../src/main/scala/scalan/Entities.scala | 3 +- .../src/main/scala/scalan/TypeDescs.scala | 4 +-- .../main/scala/scalan/primitives/Thunks.scala | 1 - .../special/collection/impl/CollsImpl.scala | 2 -- .../special/sigma/impl/SigmaDslImpl.scala | 2 -- .../test/scala/scalan/BaseLiftableTests.scala | 2 -- .../src/test/scala/scalan/LibraryTests.scala | 0 .../src/test/scala/scalan/TestContexts.scala | 22 +----------- .../src/test/scala/scalan/TestLibrary.scala | 0 .../scala/scalan/util/ScalaNameUtil.scala | 0 .../scalan/util/ScalaNameUtilSuite.scala | 9 ++++- 16 files changed, 86 insertions(+), 53 deletions(-) create mode 100644 graph-ir/js/src/test/scala/scalan/Platform.scala create mode 100644 graph-ir/jvm/src/test/scala/scalan/Platform.scala rename graph-ir/{jvm => shared}/src/test/scala/scalan/BaseLiftableTests.scala (95%) rename graph-ir/{jvm => shared}/src/test/scala/scalan/LibraryTests.scala (100%) rename graph-ir/{jvm => shared}/src/test/scala/scalan/TestContexts.scala (59%) rename graph-ir/{jvm => shared}/src/test/scala/scalan/TestLibrary.scala (100%) rename graph-ir/{jvm => shared}/src/test/scala/scalan/util/ScalaNameUtil.scala (100%) rename graph-ir/{jvm => shared}/src/test/scala/scalan/util/ScalaNameUtilSuite.scala (60%) diff --git a/common/js/src/main/scala/scalan/reflection/Platform.scala b/common/js/src/main/scala/scalan/reflection/Platform.scala index 5005f13741..4e78edef5d 100644 --- a/common/js/src/main/scala/scalan/reflection/Platform.scala +++ b/common/js/src/main/scala/scalan/reflection/Platform.scala @@ -47,4 +47,9 @@ object Platform { map.getOrElseUpdate(key, value) } } + + /** This method works for Scala 2.13+ */ + def safeSimpleName(cl: Class[_]): String = { + cl.getSimpleName + } } diff --git a/common/jvm/src/main/scala/scalan/reflection/Platform.scala b/common/jvm/src/main/scala/scalan/reflection/Platform.scala index 6030ad11a7..5b3a7970cf 100644 --- a/common/jvm/src/main/scala/scalan/reflection/Platform.scala +++ b/common/jvm/src/main/scala/scalan/reflection/Platform.scala @@ -1,5 +1,8 @@ package scalan.reflection + +import scalan.util.ReflectionUtil.isSpecialChar + import scala.collection.concurrent.TrieMap /** Platform dependent implementation of reflection methods. */ @@ -62,4 +65,19 @@ object Platform { */ def getOrElseUpdate(key: K, value: => V): V = map.getOrElseUpdate(key, value) } + + /** Safe version of `getSimpleName` that works around a bug in Scala compilers 2.11, 2.12. + * This method is only used for debugging and testing purposes. + * + * @see https://github.com/scala/bug/issues/5425 + */ + def safeSimpleName(cl: Class[_]): String = { + if (cl.getEnclosingClass == null) return cl.getSimpleName + val simpleName = cl.getName.substring(cl.getEnclosingClass.getName.length) + val length = simpleName.length + var index = 0 + while (index < length && isSpecialChar(simpleName.charAt(index))) {index += 1 } + // Eventually, this is the empty string iff this is an anonymous class + simpleName.substring(index) + } } diff --git a/common/shared/src/main/scala/scalan/util/ReflectionUtil.scala b/common/shared/src/main/scala/scalan/util/ReflectionUtil.scala index 15c73b0548..73a49d3ff8 100644 --- a/common/shared/src/main/scala/scalan/util/ReflectionUtil.scala +++ b/common/shared/src/main/scala/scalan/util/ReflectionUtil.scala @@ -3,25 +3,9 @@ package scalan.util import scala.language.existentials object ReflectionUtil { - - implicit class ClassOps(val cl: Class[_]) extends AnyVal { - /** Special character in the name. */ - private def isSpecialChar(c: Char): Boolean = { - ('0' <= c && c <= '9') || c == '$' - } - - /** Safe version of `getSimpleName` that works around a bug in Scala compilers 2.11, 2.12. - * This method is only used for debugging purposes. - * @see https://github.com/scala/bug/issues/5425 - */ - def safeSimpleName: String = { - if (cl.getEnclosingClass == null) return cl.getSimpleName - val simpleName = cl.getName.substring(cl.getEnclosingClass.getName.length) - val length = simpleName.length - var index = 0 - while (index < length && isSpecialChar(simpleName.charAt(index))) { index += 1 } - // Eventually, this is the empty string iff this is an anonymous class - simpleName.substring(index) - } + /** Special character in the name. */ + def isSpecialChar(c: Char): Boolean = { + ('0' <= c && c <= '9') || c == '$' } + } diff --git a/graph-ir/js/src/test/scala/scalan/Platform.scala b/graph-ir/js/src/test/scala/scalan/Platform.scala new file mode 100644 index 0000000000..8d6deaebce --- /dev/null +++ b/graph-ir/js/src/test/scala/scalan/Platform.scala @@ -0,0 +1,13 @@ +package scalan + +import scala.annotation.unused + +object Platform { + /** In JS tests do nothing. (The corresponding JVM method outputs graphs into files. */ + def stage[Ctx <: Scalan](scalan: Ctx)( + @unused prefix: String, + @unused testName: String, + @unused name: String, + @unused sfs: Seq[() => scalan.Sym]): Unit = { + } +} diff --git a/graph-ir/jvm/src/test/scala/scalan/Platform.scala b/graph-ir/jvm/src/test/scala/scalan/Platform.scala new file mode 100644 index 0000000000..dca77ee0bb --- /dev/null +++ b/graph-ir/jvm/src/test/scala/scalan/Platform.scala @@ -0,0 +1,34 @@ +package scalan + +import scalan.compilation.GraphVizExport +import scalan.util.FileUtil +import org.scalatest.Assertions + +object Platform { + /** Output graph given by symbols in `sfs` to files. + * @param scalan The Scalan context + * @param prefix The prefix of the directory where the graphs will be stored. + * @param testName The name of the test. + * @param name The name of the graph. + * @param sfs A sequence of functions that return symbols of the graph roots. + */ + def stage[Ctx <: Scalan](scalan: Ctx) + (prefix: String, testName: String, name: String, sfs: Seq[() => scalan.Sym]): Unit = { + val directory = FileUtil.file(prefix, testName) + val gv = new GraphVizExport(scalan) + implicit val graphVizConfig = gv.defaultGraphVizConfig + try { + val ss = sfs.map(_.apply()).asInstanceOf[Seq[gv.scalan.Sym]] + gv.emitDepGraph(ss, directory, name)(graphVizConfig) + } catch { + case e: Exception => + val graphMsg = gv.emitExceptionGraph(e, directory, name) match { + case Some(graphFile) => + s"See ${graphFile.file.getAbsolutePath} for exception graph." + case None => + s"No exception graph produced." + } + Assertions.fail(s"Staging $name failed. $graphMsg", e) + } + } +} diff --git a/graph-ir/shared/src/main/scala/scalan/Entities.scala b/graph-ir/shared/src/main/scala/scalan/Entities.scala index 376bd5a529..db830be224 100644 --- a/graph-ir/shared/src/main/scala/scalan/Entities.scala +++ b/graph-ir/shared/src/main/scala/scalan/Entities.scala @@ -1,7 +1,6 @@ package scalan import scala.language.higherKinds -import scalan.util.ReflectionUtil.ClassOps /** A slice in the Scalan cake with base classes for various descriptors. */ trait Entities extends TypeDescs { self: Scalan => @@ -14,7 +13,7 @@ trait Entities extends TypeDescs { self: Scalan => def parent: Option[Elem[_]] = None /** Name of the entity type without `Elem` suffix. */ def entityName: String = { - val n = this.getClass.safeSimpleName.stripSuffix("Elem") + val n = scalan.reflection.Platform.safeSimpleName(this.getClass).stripSuffix("Elem") n } def convert(x: Ref[Def[_]]): Ref[A] = !!!("should not be called") diff --git a/graph-ir/shared/src/main/scala/scalan/TypeDescs.scala b/graph-ir/shared/src/main/scala/scalan/TypeDescs.scala index a3d7c889af..c4ab35124b 100644 --- a/graph-ir/shared/src/main/scala/scalan/TypeDescs.scala +++ b/graph-ir/shared/src/main/scala/scalan/TypeDescs.scala @@ -95,7 +95,7 @@ abstract class TypeDescs extends Base { self: Scalan => lazy val name: String = getName(_.name) // <> to delimit because: [] is used inside name; {} looks bad with structs. - override def toString = s"${getClass.safeSimpleName}<$name>" + override def toString = s"${scalan.reflection.Platform.safeSimpleName(getClass)}<$name>" } /** Type descriptor of staged types, which correspond to source (unstaged) RTypes @@ -121,7 +121,7 @@ abstract class TypeDescs extends Base { self: Scalan => be.sourceType.name case e => val cl = e.getClass - val name = cl.safeSimpleName.stripSuffix("Elem") + val name = scalan.reflection.Platform.safeSimpleName(cl).stripSuffix("Elem") name } if (typeArgs.isEmpty) diff --git a/graph-ir/shared/src/main/scala/scalan/primitives/Thunks.scala b/graph-ir/shared/src/main/scala/scalan/primitives/Thunks.scala index 892518d7ca..030b9b5736 100644 --- a/graph-ir/shared/src/main/scala/scalan/primitives/Thunks.scala +++ b/graph-ir/shared/src/main/scala/scalan/primitives/Thunks.scala @@ -6,7 +6,6 @@ import debox.{Buffer => DBuffer, Set => DSet} import debox.cfor import scalan.reflection.RClass -import scala.reflect.runtime.universe._ import scalan.util.{Covariant, GraphUtil} import scala.collection.Seq diff --git a/graph-ir/shared/src/main/scala/special/collection/impl/CollsImpl.scala b/graph-ir/shared/src/main/scala/special/collection/impl/CollsImpl.scala index 1e9f948238..aee4ea3359 100644 --- a/graph-ir/shared/src/main/scala/special/collection/impl/CollsImpl.scala +++ b/graph-ir/shared/src/main/scala/special/collection/impl/CollsImpl.scala @@ -2,8 +2,6 @@ package special.collection import scala.language.{existentials,implicitConversions} import scalan._ -import scala.reflect.runtime.universe._ -import scala.reflect._ import scala.collection.compat.immutable.ArraySeq package impl { diff --git a/graph-ir/shared/src/main/scala/special/sigma/impl/SigmaDslImpl.scala b/graph-ir/shared/src/main/scala/special/sigma/impl/SigmaDslImpl.scala index e5b6b37b8a..0642168d68 100644 --- a/graph-ir/shared/src/main/scala/special/sigma/impl/SigmaDslImpl.scala +++ b/graph-ir/shared/src/main/scala/special/sigma/impl/SigmaDslImpl.scala @@ -2,8 +2,6 @@ package special.sigma import scala.language.{existentials,implicitConversions} import scalan._ -import scala.reflect.runtime.universe._ -import scala.reflect._ import scala.collection.compat.immutable.ArraySeq package impl { diff --git a/graph-ir/jvm/src/test/scala/scalan/BaseLiftableTests.scala b/graph-ir/shared/src/test/scala/scalan/BaseLiftableTests.scala similarity index 95% rename from graph-ir/jvm/src/test/scala/scalan/BaseLiftableTests.scala rename to graph-ir/shared/src/test/scala/scalan/BaseLiftableTests.scala index 7e28b3528f..3d437a2f1d 100644 --- a/graph-ir/jvm/src/test/scala/scalan/BaseLiftableTests.scala +++ b/graph-ir/shared/src/test/scala/scalan/BaseLiftableTests.scala @@ -1,7 +1,5 @@ package scalan -import scala.collection.mutable - trait BaseLiftableTests { self: BaseCtxTests => trait LiftableTestKit { scalan: Scalan => diff --git a/graph-ir/jvm/src/test/scala/scalan/LibraryTests.scala b/graph-ir/shared/src/test/scala/scalan/LibraryTests.scala similarity index 100% rename from graph-ir/jvm/src/test/scala/scalan/LibraryTests.scala rename to graph-ir/shared/src/test/scala/scalan/LibraryTests.scala diff --git a/graph-ir/jvm/src/test/scala/scalan/TestContexts.scala b/graph-ir/shared/src/test/scala/scalan/TestContexts.scala similarity index 59% rename from graph-ir/jvm/src/test/scala/scalan/TestContexts.scala rename to graph-ir/shared/src/test/scala/scalan/TestContexts.scala index f2a9291d5e..5f39bfe654 100644 --- a/graph-ir/jvm/src/test/scala/scalan/TestContexts.scala +++ b/graph-ir/shared/src/test/scala/scalan/TestContexts.scala @@ -1,29 +1,9 @@ package scalan -import scalan.compilation.GraphVizExport import scalan.reflection.RMethod -import scalan.util.FileUtil import special.CoreLibReflection trait TestContexts extends TestUtils { - protected[this] def stage[Ctx <: Scalan](scalan: Ctx)(testName: String, name: String, sfs: Seq[() => scalan.Sym]): Unit = { - val directory = FileUtil.file(prefix, testName) - val gv = new GraphVizExport(scalan) - implicit val graphVizConfig = gv.defaultGraphVizConfig - try { - val ss = sfs.map(_.apply()).asInstanceOf[Seq[gv.scalan.Sym]] - gv.emitDepGraph(ss, directory, name)(graphVizConfig) - } catch { - case e: Exception => - val graphMsg = gv.emitExceptionGraph(e, directory, name) match { - case Some(graphFile) => - s"See ${graphFile.file.getAbsolutePath} for exception graph." - case None => - s"No exception graph produced." - } - fail(s"Staging $name failed. $graphMsg", e) - } - } trait TestContextApi { scalan: Scalan => def invokeAll: Boolean @@ -48,7 +28,7 @@ trait TestContexts extends TestUtils { override def shouldUnpack(e: Elem[_]) = true // workaround for non-existence of by-name repeated parameters - def emitF(name: String, sfs: (() => Sym)*): Unit = stage(this)(testName, name, sfs) + def emitF(name: String, sfs: (() => Sym)*): Unit = Platform.stage(this)(prefix, testName, name, sfs) } diff --git a/graph-ir/jvm/src/test/scala/scalan/TestLibrary.scala b/graph-ir/shared/src/test/scala/scalan/TestLibrary.scala similarity index 100% rename from graph-ir/jvm/src/test/scala/scalan/TestLibrary.scala rename to graph-ir/shared/src/test/scala/scalan/TestLibrary.scala diff --git a/graph-ir/jvm/src/test/scala/scalan/util/ScalaNameUtil.scala b/graph-ir/shared/src/test/scala/scalan/util/ScalaNameUtil.scala similarity index 100% rename from graph-ir/jvm/src/test/scala/scalan/util/ScalaNameUtil.scala rename to graph-ir/shared/src/test/scala/scalan/util/ScalaNameUtil.scala diff --git a/graph-ir/jvm/src/test/scala/scalan/util/ScalaNameUtilSuite.scala b/graph-ir/shared/src/test/scala/scalan/util/ScalaNameUtilSuite.scala similarity index 60% rename from graph-ir/jvm/src/test/scala/scalan/util/ScalaNameUtilSuite.scala rename to graph-ir/shared/src/test/scala/scalan/util/ScalaNameUtilSuite.scala index 0f115784fe..5c597a216c 100644 --- a/graph-ir/jvm/src/test/scala/scalan/util/ScalaNameUtilSuite.scala +++ b/graph-ir/shared/src/test/scala/scalan/util/ScalaNameUtilSuite.scala @@ -1,18 +1,25 @@ package scalan.util import scalan.BaseTests +import scalan.reflection.CommonReflection.registerClassEntry +import scalan.reflection.{RClass, mkMethod} class ScalaNameUtilSuite extends BaseTests { def +\() = ??? import ScalaNameUtil._ + registerClassEntry(classOf[ScalaNameUtilSuite], + methods = Map( + mkMethod(classOf[ScalaNameUtilSuite], """+\""", Array[Class[_]]()) { (obj, args) => + obj.asInstanceOf[ScalaNameUtilSuite].+\() + })) test("Operator names should be decoded correctly") { cleanScalaName("$plus$bslash$up") shouldEqual("""+\^""") } test("Method names obtained by reflection should be decoded") { - val methodNames = classOf[ScalaNameUtilSuite].getDeclaredMethods.map { + val methodNames = RClass(classOf[ScalaNameUtilSuite]).getDeclaredMethods.map { m => cleanScalaName(m.getName) }.toList.filterNot(n => n.startsWith("$")) From f50dc93afc1eb5bc82c8f25cfde404e9508fdbb7 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Tue, 13 Jun 2023 21:18:40 +0200 Subject: [PATCH 04/58] compiler-js: all tests of graphir module passed under JS --- .../test/scala/special/collections/BaseCostedTests.scala | 8 -------- graph-ir/shared/src/test/scala/scalan/LibraryTests.scala | 2 +- .../scala/special/collections/CollsStagingTests.scala | 3 +-- .../src/test/scala/special/wrappers/WOptionTests.scala | 0 .../src/test/scala/special/wrappers/WRTypeTests.scala | 0 .../test/scala/special/wrappers/WSpecialPredefTests.scala | 0 .../src/test/scala/special/wrappers/WrappersTests.scala | 0 7 files changed, 2 insertions(+), 11 deletions(-) delete mode 100644 graph-ir/jvm/src/test/scala/special/collections/BaseCostedTests.scala rename graph-ir/{jvm => shared}/src/test/scala/special/collections/CollsStagingTests.scala (98%) rename graph-ir/{jvm => shared}/src/test/scala/special/wrappers/WOptionTests.scala (100%) rename graph-ir/{jvm => shared}/src/test/scala/special/wrappers/WRTypeTests.scala (100%) rename graph-ir/{jvm => shared}/src/test/scala/special/wrappers/WSpecialPredefTests.scala (100%) rename graph-ir/{jvm => shared}/src/test/scala/special/wrappers/WrappersTests.scala (100%) diff --git a/graph-ir/jvm/src/test/scala/special/collections/BaseCostedTests.scala b/graph-ir/jvm/src/test/scala/special/collections/BaseCostedTests.scala deleted file mode 100644 index 8b3096ae0f..0000000000 --- a/graph-ir/jvm/src/test/scala/special/collections/BaseCostedTests.scala +++ /dev/null @@ -1,8 +0,0 @@ -package special.collections - -import scalan.{BaseCtxTests, TestLibrary} - -class BaseCostedTests extends BaseCtxTests { - class Ctx extends TestContext with TestLibrary { - } -} diff --git a/graph-ir/shared/src/test/scala/scalan/LibraryTests.scala b/graph-ir/shared/src/test/scala/scalan/LibraryTests.scala index 3c3982430c..299a1961cc 100644 --- a/graph-ir/shared/src/test/scala/scalan/LibraryTests.scala +++ b/graph-ir/shared/src/test/scala/scalan/LibraryTests.scala @@ -8,7 +8,7 @@ class Benchmark[T <: Scalan](createContext: => T) { def run() = { val (ctx, total) = measureTime { var ctx = createContext - measure(100000, okShowIterTime = printDebugInfo, okShowTotalTime = printDebugInfo) { i => + measure(10000, okShowIterTime = printDebugInfo, okShowTotalTime = printDebugInfo) { i => ctx = createContext } ctx diff --git a/graph-ir/jvm/src/test/scala/special/collections/CollsStagingTests.scala b/graph-ir/shared/src/test/scala/special/collections/CollsStagingTests.scala similarity index 98% rename from graph-ir/jvm/src/test/scala/special/collections/CollsStagingTests.scala rename to graph-ir/shared/src/test/scala/special/collections/CollsStagingTests.scala index cf56428d71..7abe786b04 100644 --- a/graph-ir/jvm/src/test/scala/special/collections/CollsStagingTests.scala +++ b/graph-ir/shared/src/test/scala/special/collections/CollsStagingTests.scala @@ -3,7 +3,6 @@ package special.collections import scala.language.reflectiveCalls import special.wrappers.WrappersTests import scalan._ -import scalan.util.BenchmarkUtil._ class CollsStagingTests extends WrappersTests { val printDebugInfo: Boolean = false @@ -43,10 +42,10 @@ class CollsStagingTests extends WrappersTests { test("invokeUnlifted for Col") { val ctx = new WrappersCtx with Library import ctx._ - import Liftables._ import Coll._ import CollBuilder._ import EnvRep._ + import Liftables._ val Cols: SCollBuilder = new special.collection.CollOverArrayBuilder val arr = Array(1, 2, 3) diff --git a/graph-ir/jvm/src/test/scala/special/wrappers/WOptionTests.scala b/graph-ir/shared/src/test/scala/special/wrappers/WOptionTests.scala similarity index 100% rename from graph-ir/jvm/src/test/scala/special/wrappers/WOptionTests.scala rename to graph-ir/shared/src/test/scala/special/wrappers/WOptionTests.scala diff --git a/graph-ir/jvm/src/test/scala/special/wrappers/WRTypeTests.scala b/graph-ir/shared/src/test/scala/special/wrappers/WRTypeTests.scala similarity index 100% rename from graph-ir/jvm/src/test/scala/special/wrappers/WRTypeTests.scala rename to graph-ir/shared/src/test/scala/special/wrappers/WRTypeTests.scala diff --git a/graph-ir/jvm/src/test/scala/special/wrappers/WSpecialPredefTests.scala b/graph-ir/shared/src/test/scala/special/wrappers/WSpecialPredefTests.scala similarity index 100% rename from graph-ir/jvm/src/test/scala/special/wrappers/WSpecialPredefTests.scala rename to graph-ir/shared/src/test/scala/special/wrappers/WSpecialPredefTests.scala diff --git a/graph-ir/jvm/src/test/scala/special/wrappers/WrappersTests.scala b/graph-ir/shared/src/test/scala/special/wrappers/WrappersTests.scala similarity index 100% rename from graph-ir/jvm/src/test/scala/special/wrappers/WrappersTests.scala rename to graph-ir/shared/src/test/scala/special/wrappers/WrappersTests.scala From 86745345e62673fb11b8ab36305c464df218bd59 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Wed, 14 Jun 2023 16:09:36 +0200 Subject: [PATCH 05/58] compiler-js: setup crossProject for sc module and make it compile --- build.sbt | 43 ++++++++++++++----- .../scala/sigmastate/ErgoTreeBenchmarks.scala | 8 ++-- .../InterpreterReflectionGeneratorTests.scala | 0 .../sigmastate/ReflectionGenerator.scala | 2 +- .../sigmastate/utils/GenPredefFuncsApp.scala | 0 .../sigmastate/utils/GenPredefTypesApp.scala | 0 .../sigmastate/utils/GenSerializers.scala | 4 +- .../org/ergoplatform/ErgoScriptPredef.scala | 0 .../org/ergoplatform/dsl/ContractSpec.scala | 0 .../org/ergoplatform/dsl/ContractSyntax.scala | 0 .../ergoplatform/dsl/ErgoContractSpec.scala | 0 .../org/ergoplatform/dsl/StdContracts.scala | 0 .../scala/sigmastate/eval/GraphBuilding.scala | 0 .../scala/sigmastate/eval/IRContext.scala | 0 .../scala/sigmastate/eval/TreeBuilding.scala | 0 .../scala/sigmastate/lang/SigmaBinder.scala | 0 .../scala/sigmastate/lang/SigmaCompiler.scala | 0 .../scala/sigmastate/lang/SigmaTyper.scala | 0 .../scala/org/ergoplatform/EmissionSpec.scala | 0 .../ErgoAddressSpecification.scala | 0 .../ErgoLikeTransactionSpec.scala | 0 .../org/ergoplatform/ErgoTreePredefSpec.scala | 0 .../ergoplatform/dsl/TestContractSpec.scala | 0 .../validation/RuleStatusSerializerSpec.scala | 0 ...igmaValidationSettingsSerializerSpec.scala | 0 .../CompilerCrossVersionProps.scala | 0 .../scala/sigmastate/CompilerTestsBase.scala | 0 .../sigmastate/ErgoTreeSpecification.scala | 0 .../scala/sigmastate/FailingToProveSpec.scala | 0 .../ScriptVersionSwitchSpecification.scala | 0 .../SoftForkabilitySpecification.scala | 0 .../TestingInterpreterSpecification.scala | 0 .../scala/sigmastate/TypesSpecification.scala | 0 .../sigmastate/eval/ErgoScriptTestkit.scala | 0 .../eval/ErgoTreeBuildingTest.scala | 0 .../sigmastate/eval/EvaluationTest.scala | 0 .../sigmastate/eval/ExampleContracts.scala | 0 .../sigmastate/eval/MeasureIRContext.scala | 0 .../helpers/CompilerTestingCommons.scala | 0 .../sigmastate/helpers/SigmaPPrint.scala | 0 .../sigmastate/helpers/SigmaPPrintSpec.scala | 0 .../sigmastate/lang/SigmaBinderTest.scala | 0 .../sigmastate/lang/SigmaBuilderTest.scala | 0 .../sigmastate/lang/SigmaCompilerTest.scala | 0 .../sigmastate/lang/SigmaTyperTest.scala | 0 .../DeserializationResilience.scala | 0 .../ErgoTreeSerializerSpecification.scala | 0 .../sigmastate/utils/GenInfoObjects.scala | 0 .../test/scala/sigmastate/utils/SpecGen.scala | 0 .../utxo/AVLTreeScriptsSpecification.scala | 0 .../utxo/BasicOpsSpecification.scala | 0 .../BlockchainSimulationSpecification.scala | 0 .../CollectionOperationsSpecification.scala | 0 .../utxo/ComplexSigSpecification.scala | 0 .../utxo/ContextEnrichingSpecification.scala | 0 .../utxo/DistributedSigSpecification.scala | 0 .../ErgoLikeInterpreterSpecification.scala | 0 .../utxo/SerializationRoundTripSpec.scala | 0 .../utxo/SigmaCompilerSpecification.scala | 0 .../utxo/ThresholdSpecification.scala | 0 .../UsingContextPropertiesSpecification.scala | 0 .../BlockchainSimulationSpecification.scala | 0 .../BlockchainSimulationTestingCommons.scala | 0 .../utxo/examples/AssetsAtomicExchange.scala | 0 .../AssetsAtomicExchangeErgoTests.scala | 0 .../examples/AssetsAtomicExchangeTests.scala | 0 .../utxo/examples/AssetsPartialFilling.scala | 0 .../AtomicSwapExampleSpecification.scala | 0 .../examples/CoinEmissionSpecification.scala | 0 ...alletAdvContractExampleSpecification.scala | 0 ...ldWalletContractExampleSpecification.scala | 0 .../examples/CoopExampleSpecification.scala | 0 .../utxo/examples/CrowdFunding.scala | 0 .../utxo/examples/CrowdFundingTests.scala | 0 .../DHTupleExampleSpecification.scala | 0 .../DemurrageExampleSpecification.scala | 0 .../examples/DummyExamplesSpecification.scala | 0 .../ExecuteFromExamplesSpecification.scala | 0 .../examples/FsmExampleSpecification.scala | 0 .../sigmastate/utxo/examples/IcoExample.scala | 0 .../utxo/examples/LetsSpecification.scala | 0 .../examples/MASTExampleSpecification.scala | 0 .../examples/MixExampleSpecification.scala | 0 ...racleDataInputsExamplesSpecification.scala | 0 .../OracleExamplesSpecification.scala | 0 .../OracleTokenExamplesSpecification.scala | 0 .../RPSGameExampleSpecification.scala | 0 .../RevenueSharingExamplesSpecification.scala | 0 .../ReversibleTxExampleSpecification.scala | 0 .../utxo/examples/Rule110Specification.scala | 0 .../TimedPaymentExampleSpecification.scala | 0 .../utxo/examples/TrustlessLETS.scala | 0 .../XorGameExampleSpecification.scala | 0 .../DataValueComparerSpecification.scala | 0 .../test/scala/special/sigma/LoopTests.scala | 0 .../special/sigma/SigmaDslSpecification.scala | 0 .../special/sigma/SigmaDslStaginTests.scala | 4 +- .../scala/special/sigma/SigmaDslTesting.scala | 0 .../test/scala/thelastpackage/ZLastSpec.scala | 1 - 99 files changed, 42 insertions(+), 20 deletions(-) rename sc/{ => jvm}/src/test/scala/sigmastate/ErgoTreeBenchmarks.scala (96%) rename sc/{ => jvm}/src/test/scala/sigmastate/InterpreterReflectionGeneratorTests.scala (100%) rename sc/{ => jvm}/src/test/scala/sigmastate/ReflectionGenerator.scala (100%) rename sc/{ => jvm}/src/test/scala/sigmastate/utils/GenPredefFuncsApp.scala (100%) rename sc/{ => jvm}/src/test/scala/sigmastate/utils/GenPredefTypesApp.scala (100%) rename sc/{ => jvm}/src/test/scala/sigmastate/utils/GenSerializers.scala (99%) rename sc/{ => shared}/src/main/scala/org/ergoplatform/ErgoScriptPredef.scala (100%) rename sc/{ => shared}/src/main/scala/org/ergoplatform/dsl/ContractSpec.scala (100%) rename sc/{ => shared}/src/main/scala/org/ergoplatform/dsl/ContractSyntax.scala (100%) rename sc/{ => shared}/src/main/scala/org/ergoplatform/dsl/ErgoContractSpec.scala (100%) rename sc/{ => shared}/src/main/scala/org/ergoplatform/dsl/StdContracts.scala (100%) rename sc/{ => shared}/src/main/scala/sigmastate/eval/GraphBuilding.scala (100%) rename sc/{ => shared}/src/main/scala/sigmastate/eval/IRContext.scala (100%) rename sc/{ => shared}/src/main/scala/sigmastate/eval/TreeBuilding.scala (100%) rename sc/{ => shared}/src/main/scala/sigmastate/lang/SigmaBinder.scala (100%) rename sc/{ => shared}/src/main/scala/sigmastate/lang/SigmaCompiler.scala (100%) rename sc/{ => shared}/src/main/scala/sigmastate/lang/SigmaTyper.scala (100%) rename sc/{ => shared}/src/test/scala/org/ergoplatform/EmissionSpec.scala (100%) rename sc/{ => shared}/src/test/scala/org/ergoplatform/ErgoAddressSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/org/ergoplatform/ErgoLikeTransactionSpec.scala (100%) rename sc/{ => shared}/src/test/scala/org/ergoplatform/ErgoTreePredefSpec.scala (100%) rename sc/{ => shared}/src/test/scala/org/ergoplatform/dsl/TestContractSpec.scala (100%) rename sc/{ => shared}/src/test/scala/org/ergoplatform/validation/RuleStatusSerializerSpec.scala (100%) rename sc/{ => shared}/src/test/scala/org/ergoplatform/validation/SigmaValidationSettingsSerializerSpec.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/CompilerCrossVersionProps.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/CompilerTestsBase.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/ErgoTreeSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/FailingToProveSpec.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/ScriptVersionSwitchSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/SoftForkabilitySpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/TestingInterpreterSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/TypesSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/eval/ErgoScriptTestkit.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/eval/ErgoTreeBuildingTest.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/eval/EvaluationTest.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/eval/ExampleContracts.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/eval/MeasureIRContext.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/helpers/CompilerTestingCommons.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/helpers/SigmaPPrint.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/helpers/SigmaPPrintSpec.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/lang/SigmaBinderTest.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/lang/SigmaBuilderTest.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/lang/SigmaCompilerTest.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/lang/SigmaTyperTest.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/serialization/DeserializationResilience.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/serialization/ErgoTreeSerializerSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utils/GenInfoObjects.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utils/SpecGen.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/AVLTreeScriptsSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/BasicOpsSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/BlockchainSimulationSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/CollectionOperationsSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/ComplexSigSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/ContextEnrichingSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/DistributedSigSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/ErgoLikeInterpreterSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/SerializationRoundTripSpec.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/SigmaCompilerSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/ThresholdSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/UsingContextPropertiesSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/blockchain/BlockchainSimulationSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/blockchain/BlockchainSimulationTestingCommons.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/examples/AssetsAtomicExchange.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/examples/AssetsAtomicExchangeErgoTests.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/examples/AssetsAtomicExchangeTests.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/examples/AssetsPartialFilling.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/examples/AtomicSwapExampleSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/examples/CoinEmissionSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/examples/ColdWalletAdvContractExampleSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/examples/ColdWalletContractExampleSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/examples/CoopExampleSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/examples/CrowdFunding.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/examples/CrowdFundingTests.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/examples/DHTupleExampleSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/examples/DemurrageExampleSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/examples/DummyExamplesSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/examples/ExecuteFromExamplesSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/examples/FsmExampleSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/examples/IcoExample.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/examples/LetsSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/examples/MASTExampleSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/examples/MixExampleSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/examples/OracleDataInputsExamplesSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/examples/OracleExamplesSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/examples/OracleTokenExamplesSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/examples/RPSGameExampleSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/examples/RevenueSharingExamplesSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/examples/ReversibleTxExampleSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/examples/Rule110Specification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/examples/TimedPaymentExampleSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/examples/TrustlessLETS.scala (100%) rename sc/{ => shared}/src/test/scala/sigmastate/utxo/examples/XorGameExampleSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/special/sigma/DataValueComparerSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/special/sigma/LoopTests.scala (100%) rename sc/{ => shared}/src/test/scala/special/sigma/SigmaDslSpecification.scala (100%) rename sc/{ => shared}/src/test/scala/special/sigma/SigmaDslStaginTests.scala (93%) rename sc/{ => shared}/src/test/scala/special/sigma/SigmaDslTesting.scala (100%) rename sc/{ => shared}/src/test/scala/thelastpackage/ZLastSpec.scala (94%) diff --git a/build.sbt b/build.sbt index 5f07f92dd2..6f1debda63 100644 --- a/build.sbt +++ b/build.sbt @@ -277,8 +277,9 @@ lazy val parsers = crossProject(JVMPlatform, JSPlatform) .in(file("parsers")) .dependsOn(interpreter % allConfigDependency) .settings(libraryDefSettings) - .settings(libraryDependencies ++= - Seq(scorexUtil, fastparse) ++ circeDeps(scalaVersion.value) + .settings( + libraryDependencies ++= Seq(scorexUtil, fastparse) ++ circeDeps(scalaVersion.value), + publish / skip := true ) .jvmSettings( crossScalaSettings @@ -293,17 +294,39 @@ lazy val parsers = crossProject(JVMPlatform, JSPlatform) lazy val parsersJS = parsers.js .enablePlugins(ScalaJSBundlerPlugin) -lazy val sc = (project in file("sc")) +lazy val sc = crossProject(JVMPlatform, JSPlatform) + .in(file("sc")) .dependsOn( - graphir.jvm % allConfigDependency, - interpreter.jvm % allConfigDependency, - parsers.jvm % allConfigDependency + graphir % allConfigDependency, + interpreter % allConfigDependency, + parsers % allConfigDependency ) .settings(libraryDefSettings) - .settings(libraryDependencies ++= - Seq(scorexUtil, fastparse) ++ circeDeps(scalaVersion.value) + .settings( + libraryDependencies ++= Seq(scorexUtil, fastparse) ++ circeDeps(scalaVersion.value) ) .settings(publish / skip := true) + .jvmSettings( + crossScalaSettings + ) + .jsSettings( + crossScalaSettingsJS, + libraryDependencies ++= Seq( + "org.scala-js" %%% "scala-js-macrotask-executor" % "1.0.0" + ), + useYarn := true + ) +lazy val scJS = sc.js + .enablePlugins(ScalaJSBundlerPlugin) + .settings( + scalaJSLinkerConfig ~= { conf => + conf.withSourceMap(false) + .withModuleKind(ModuleKind.CommonJSModule) + }, + Compile / npmDependencies ++= Seq( + "sigmajs-crypto-facade" -> sigmajsCryptoFacadeVersion + ) + ) lazy val sdk = crossProject(JVMPlatform, JSPlatform) .in(file("sdk")) @@ -337,13 +360,13 @@ lazy val sdkJS = sdk.js ) lazy val sigma = (project in file(".")) - .aggregate(common.jvm, corelib.jvm, graphir.jvm, interpreter.jvm, parsers.jvm, sc, sdk.jvm) + .aggregate(common.jvm, corelib.jvm, graphir.jvm, interpreter.jvm, parsers.jvm, sc.jvm, sdk.jvm) .settings(libraryDefSettings, rootSettings) .settings(publish / aggregate := false) .settings(publishLocal / aggregate := false) lazy val aggregateCompile = ScopeFilter( - inProjects(common.jvm, corelib.jvm, graphir.jvm, interpreter.jvm, parsers.jvm, sc, sdk.jvm), + inProjects(common.jvm, corelib.jvm, graphir.jvm, interpreter.jvm, parsers.jvm, sc.jvm, sdk.jvm), inConfigurations(Compile)) lazy val rootSettings = Seq( diff --git a/sc/src/test/scala/sigmastate/ErgoTreeBenchmarks.scala b/sc/jvm/src/test/scala/sigmastate/ErgoTreeBenchmarks.scala similarity index 96% rename from sc/src/test/scala/sigmastate/ErgoTreeBenchmarks.scala rename to sc/jvm/src/test/scala/sigmastate/ErgoTreeBenchmarks.scala index c7587712f2..c672b43e89 100644 --- a/sc/src/test/scala/sigmastate/ErgoTreeBenchmarks.scala +++ b/sc/jvm/src/test/scala/sigmastate/ErgoTreeBenchmarks.scala @@ -1,11 +1,11 @@ package sigmastate -import special.collections.BenchmarkGens -import org.scalameter.api.Bench -import sigmastate.Values.{SValue, Constant, IntConstant} -import sigmastate.serialization.OpCodes.PlusCode import debox.cfor +import org.scalameter.api.Bench +import sigmastate.Values.{IntConstant, SValue} import sigmastate.crypto.Platform +import sigmastate.serialization.OpCodes.PlusCode +import special.collections.BenchmarkGens object ErgoTreeBenchmarks extends Bench.LocalTime with BenchmarkGens { suite: Bench[Double] => diff --git a/sc/src/test/scala/sigmastate/InterpreterReflectionGeneratorTests.scala b/sc/jvm/src/test/scala/sigmastate/InterpreterReflectionGeneratorTests.scala similarity index 100% rename from sc/src/test/scala/sigmastate/InterpreterReflectionGeneratorTests.scala rename to sc/jvm/src/test/scala/sigmastate/InterpreterReflectionGeneratorTests.scala diff --git a/sc/src/test/scala/sigmastate/ReflectionGenerator.scala b/sc/jvm/src/test/scala/sigmastate/ReflectionGenerator.scala similarity index 100% rename from sc/src/test/scala/sigmastate/ReflectionGenerator.scala rename to sc/jvm/src/test/scala/sigmastate/ReflectionGenerator.scala index f3301a2f0c..c790cc3b42 100644 --- a/sc/src/test/scala/sigmastate/ReflectionGenerator.scala +++ b/sc/jvm/src/test/scala/sigmastate/ReflectionGenerator.scala @@ -1,9 +1,9 @@ package sigmastate +import scalan.reflection._ import scalan.{Base, TypeDescs} import scala.collection.mutable -import scalan.reflection._ object ReflectionGenerator { diff --git a/sc/src/test/scala/sigmastate/utils/GenPredefFuncsApp.scala b/sc/jvm/src/test/scala/sigmastate/utils/GenPredefFuncsApp.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utils/GenPredefFuncsApp.scala rename to sc/jvm/src/test/scala/sigmastate/utils/GenPredefFuncsApp.scala diff --git a/sc/src/test/scala/sigmastate/utils/GenPredefTypesApp.scala b/sc/jvm/src/test/scala/sigmastate/utils/GenPredefTypesApp.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utils/GenPredefTypesApp.scala rename to sc/jvm/src/test/scala/sigmastate/utils/GenPredefTypesApp.scala diff --git a/sc/src/test/scala/sigmastate/utils/GenSerializers.scala b/sc/jvm/src/test/scala/sigmastate/utils/GenSerializers.scala similarity index 99% rename from sc/src/test/scala/sigmastate/utils/GenSerializers.scala rename to sc/jvm/src/test/scala/sigmastate/utils/GenSerializers.scala index 5d1c8ae0e1..c55c300d4a 100644 --- a/sc/src/test/scala/sigmastate/utils/GenSerializers.scala +++ b/sc/jvm/src/test/scala/sigmastate/utils/GenSerializers.scala @@ -1,10 +1,10 @@ package sigmastate.utils +import scalan.util.Extensions.ByteOps import scalan.util.FileUtil import scalan.util.PrintExtensions._ +import sigmastate.lang.Terms.{MethodCall, PropertyCall} import sigmastate.serialization.ValueSerializer._ -import scalan.util.Extensions.ByteOps -import sigmastate.lang.Terms.{PropertyCall, MethodCall} /** Generate contents of ErgoTree serializer format specification. * To generate serialization formats, it is necessary that all branches of serializers diff --git a/sc/src/main/scala/org/ergoplatform/ErgoScriptPredef.scala b/sc/shared/src/main/scala/org/ergoplatform/ErgoScriptPredef.scala similarity index 100% rename from sc/src/main/scala/org/ergoplatform/ErgoScriptPredef.scala rename to sc/shared/src/main/scala/org/ergoplatform/ErgoScriptPredef.scala diff --git a/sc/src/main/scala/org/ergoplatform/dsl/ContractSpec.scala b/sc/shared/src/main/scala/org/ergoplatform/dsl/ContractSpec.scala similarity index 100% rename from sc/src/main/scala/org/ergoplatform/dsl/ContractSpec.scala rename to sc/shared/src/main/scala/org/ergoplatform/dsl/ContractSpec.scala diff --git a/sc/src/main/scala/org/ergoplatform/dsl/ContractSyntax.scala b/sc/shared/src/main/scala/org/ergoplatform/dsl/ContractSyntax.scala similarity index 100% rename from sc/src/main/scala/org/ergoplatform/dsl/ContractSyntax.scala rename to sc/shared/src/main/scala/org/ergoplatform/dsl/ContractSyntax.scala diff --git a/sc/src/main/scala/org/ergoplatform/dsl/ErgoContractSpec.scala b/sc/shared/src/main/scala/org/ergoplatform/dsl/ErgoContractSpec.scala similarity index 100% rename from sc/src/main/scala/org/ergoplatform/dsl/ErgoContractSpec.scala rename to sc/shared/src/main/scala/org/ergoplatform/dsl/ErgoContractSpec.scala diff --git a/sc/src/main/scala/org/ergoplatform/dsl/StdContracts.scala b/sc/shared/src/main/scala/org/ergoplatform/dsl/StdContracts.scala similarity index 100% rename from sc/src/main/scala/org/ergoplatform/dsl/StdContracts.scala rename to sc/shared/src/main/scala/org/ergoplatform/dsl/StdContracts.scala diff --git a/sc/src/main/scala/sigmastate/eval/GraphBuilding.scala b/sc/shared/src/main/scala/sigmastate/eval/GraphBuilding.scala similarity index 100% rename from sc/src/main/scala/sigmastate/eval/GraphBuilding.scala rename to sc/shared/src/main/scala/sigmastate/eval/GraphBuilding.scala diff --git a/sc/src/main/scala/sigmastate/eval/IRContext.scala b/sc/shared/src/main/scala/sigmastate/eval/IRContext.scala similarity index 100% rename from sc/src/main/scala/sigmastate/eval/IRContext.scala rename to sc/shared/src/main/scala/sigmastate/eval/IRContext.scala diff --git a/sc/src/main/scala/sigmastate/eval/TreeBuilding.scala b/sc/shared/src/main/scala/sigmastate/eval/TreeBuilding.scala similarity index 100% rename from sc/src/main/scala/sigmastate/eval/TreeBuilding.scala rename to sc/shared/src/main/scala/sigmastate/eval/TreeBuilding.scala diff --git a/sc/src/main/scala/sigmastate/lang/SigmaBinder.scala b/sc/shared/src/main/scala/sigmastate/lang/SigmaBinder.scala similarity index 100% rename from sc/src/main/scala/sigmastate/lang/SigmaBinder.scala rename to sc/shared/src/main/scala/sigmastate/lang/SigmaBinder.scala diff --git a/sc/src/main/scala/sigmastate/lang/SigmaCompiler.scala b/sc/shared/src/main/scala/sigmastate/lang/SigmaCompiler.scala similarity index 100% rename from sc/src/main/scala/sigmastate/lang/SigmaCompiler.scala rename to sc/shared/src/main/scala/sigmastate/lang/SigmaCompiler.scala diff --git a/sc/src/main/scala/sigmastate/lang/SigmaTyper.scala b/sc/shared/src/main/scala/sigmastate/lang/SigmaTyper.scala similarity index 100% rename from sc/src/main/scala/sigmastate/lang/SigmaTyper.scala rename to sc/shared/src/main/scala/sigmastate/lang/SigmaTyper.scala diff --git a/sc/src/test/scala/org/ergoplatform/EmissionSpec.scala b/sc/shared/src/test/scala/org/ergoplatform/EmissionSpec.scala similarity index 100% rename from sc/src/test/scala/org/ergoplatform/EmissionSpec.scala rename to sc/shared/src/test/scala/org/ergoplatform/EmissionSpec.scala diff --git a/sc/src/test/scala/org/ergoplatform/ErgoAddressSpecification.scala b/sc/shared/src/test/scala/org/ergoplatform/ErgoAddressSpecification.scala similarity index 100% rename from sc/src/test/scala/org/ergoplatform/ErgoAddressSpecification.scala rename to sc/shared/src/test/scala/org/ergoplatform/ErgoAddressSpecification.scala diff --git a/sc/src/test/scala/org/ergoplatform/ErgoLikeTransactionSpec.scala b/sc/shared/src/test/scala/org/ergoplatform/ErgoLikeTransactionSpec.scala similarity index 100% rename from sc/src/test/scala/org/ergoplatform/ErgoLikeTransactionSpec.scala rename to sc/shared/src/test/scala/org/ergoplatform/ErgoLikeTransactionSpec.scala diff --git a/sc/src/test/scala/org/ergoplatform/ErgoTreePredefSpec.scala b/sc/shared/src/test/scala/org/ergoplatform/ErgoTreePredefSpec.scala similarity index 100% rename from sc/src/test/scala/org/ergoplatform/ErgoTreePredefSpec.scala rename to sc/shared/src/test/scala/org/ergoplatform/ErgoTreePredefSpec.scala diff --git a/sc/src/test/scala/org/ergoplatform/dsl/TestContractSpec.scala b/sc/shared/src/test/scala/org/ergoplatform/dsl/TestContractSpec.scala similarity index 100% rename from sc/src/test/scala/org/ergoplatform/dsl/TestContractSpec.scala rename to sc/shared/src/test/scala/org/ergoplatform/dsl/TestContractSpec.scala diff --git a/sc/src/test/scala/org/ergoplatform/validation/RuleStatusSerializerSpec.scala b/sc/shared/src/test/scala/org/ergoplatform/validation/RuleStatusSerializerSpec.scala similarity index 100% rename from sc/src/test/scala/org/ergoplatform/validation/RuleStatusSerializerSpec.scala rename to sc/shared/src/test/scala/org/ergoplatform/validation/RuleStatusSerializerSpec.scala diff --git a/sc/src/test/scala/org/ergoplatform/validation/SigmaValidationSettingsSerializerSpec.scala b/sc/shared/src/test/scala/org/ergoplatform/validation/SigmaValidationSettingsSerializerSpec.scala similarity index 100% rename from sc/src/test/scala/org/ergoplatform/validation/SigmaValidationSettingsSerializerSpec.scala rename to sc/shared/src/test/scala/org/ergoplatform/validation/SigmaValidationSettingsSerializerSpec.scala diff --git a/sc/src/test/scala/sigmastate/CompilerCrossVersionProps.scala b/sc/shared/src/test/scala/sigmastate/CompilerCrossVersionProps.scala similarity index 100% rename from sc/src/test/scala/sigmastate/CompilerCrossVersionProps.scala rename to sc/shared/src/test/scala/sigmastate/CompilerCrossVersionProps.scala diff --git a/sc/src/test/scala/sigmastate/CompilerTestsBase.scala b/sc/shared/src/test/scala/sigmastate/CompilerTestsBase.scala similarity index 100% rename from sc/src/test/scala/sigmastate/CompilerTestsBase.scala rename to sc/shared/src/test/scala/sigmastate/CompilerTestsBase.scala diff --git a/sc/src/test/scala/sigmastate/ErgoTreeSpecification.scala b/sc/shared/src/test/scala/sigmastate/ErgoTreeSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/ErgoTreeSpecification.scala rename to sc/shared/src/test/scala/sigmastate/ErgoTreeSpecification.scala diff --git a/sc/src/test/scala/sigmastate/FailingToProveSpec.scala b/sc/shared/src/test/scala/sigmastate/FailingToProveSpec.scala similarity index 100% rename from sc/src/test/scala/sigmastate/FailingToProveSpec.scala rename to sc/shared/src/test/scala/sigmastate/FailingToProveSpec.scala diff --git a/sc/src/test/scala/sigmastate/ScriptVersionSwitchSpecification.scala b/sc/shared/src/test/scala/sigmastate/ScriptVersionSwitchSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/ScriptVersionSwitchSpecification.scala rename to sc/shared/src/test/scala/sigmastate/ScriptVersionSwitchSpecification.scala diff --git a/sc/src/test/scala/sigmastate/SoftForkabilitySpecification.scala b/sc/shared/src/test/scala/sigmastate/SoftForkabilitySpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/SoftForkabilitySpecification.scala rename to sc/shared/src/test/scala/sigmastate/SoftForkabilitySpecification.scala diff --git a/sc/src/test/scala/sigmastate/TestingInterpreterSpecification.scala b/sc/shared/src/test/scala/sigmastate/TestingInterpreterSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/TestingInterpreterSpecification.scala rename to sc/shared/src/test/scala/sigmastate/TestingInterpreterSpecification.scala diff --git a/sc/src/test/scala/sigmastate/TypesSpecification.scala b/sc/shared/src/test/scala/sigmastate/TypesSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/TypesSpecification.scala rename to sc/shared/src/test/scala/sigmastate/TypesSpecification.scala diff --git a/sc/src/test/scala/sigmastate/eval/ErgoScriptTestkit.scala b/sc/shared/src/test/scala/sigmastate/eval/ErgoScriptTestkit.scala similarity index 100% rename from sc/src/test/scala/sigmastate/eval/ErgoScriptTestkit.scala rename to sc/shared/src/test/scala/sigmastate/eval/ErgoScriptTestkit.scala diff --git a/sc/src/test/scala/sigmastate/eval/ErgoTreeBuildingTest.scala b/sc/shared/src/test/scala/sigmastate/eval/ErgoTreeBuildingTest.scala similarity index 100% rename from sc/src/test/scala/sigmastate/eval/ErgoTreeBuildingTest.scala rename to sc/shared/src/test/scala/sigmastate/eval/ErgoTreeBuildingTest.scala diff --git a/sc/src/test/scala/sigmastate/eval/EvaluationTest.scala b/sc/shared/src/test/scala/sigmastate/eval/EvaluationTest.scala similarity index 100% rename from sc/src/test/scala/sigmastate/eval/EvaluationTest.scala rename to sc/shared/src/test/scala/sigmastate/eval/EvaluationTest.scala diff --git a/sc/src/test/scala/sigmastate/eval/ExampleContracts.scala b/sc/shared/src/test/scala/sigmastate/eval/ExampleContracts.scala similarity index 100% rename from sc/src/test/scala/sigmastate/eval/ExampleContracts.scala rename to sc/shared/src/test/scala/sigmastate/eval/ExampleContracts.scala diff --git a/sc/src/test/scala/sigmastate/eval/MeasureIRContext.scala b/sc/shared/src/test/scala/sigmastate/eval/MeasureIRContext.scala similarity index 100% rename from sc/src/test/scala/sigmastate/eval/MeasureIRContext.scala rename to sc/shared/src/test/scala/sigmastate/eval/MeasureIRContext.scala diff --git a/sc/src/test/scala/sigmastate/helpers/CompilerTestingCommons.scala b/sc/shared/src/test/scala/sigmastate/helpers/CompilerTestingCommons.scala similarity index 100% rename from sc/src/test/scala/sigmastate/helpers/CompilerTestingCommons.scala rename to sc/shared/src/test/scala/sigmastate/helpers/CompilerTestingCommons.scala diff --git a/sc/src/test/scala/sigmastate/helpers/SigmaPPrint.scala b/sc/shared/src/test/scala/sigmastate/helpers/SigmaPPrint.scala similarity index 100% rename from sc/src/test/scala/sigmastate/helpers/SigmaPPrint.scala rename to sc/shared/src/test/scala/sigmastate/helpers/SigmaPPrint.scala diff --git a/sc/src/test/scala/sigmastate/helpers/SigmaPPrintSpec.scala b/sc/shared/src/test/scala/sigmastate/helpers/SigmaPPrintSpec.scala similarity index 100% rename from sc/src/test/scala/sigmastate/helpers/SigmaPPrintSpec.scala rename to sc/shared/src/test/scala/sigmastate/helpers/SigmaPPrintSpec.scala diff --git a/sc/src/test/scala/sigmastate/lang/SigmaBinderTest.scala b/sc/shared/src/test/scala/sigmastate/lang/SigmaBinderTest.scala similarity index 100% rename from sc/src/test/scala/sigmastate/lang/SigmaBinderTest.scala rename to sc/shared/src/test/scala/sigmastate/lang/SigmaBinderTest.scala diff --git a/sc/src/test/scala/sigmastate/lang/SigmaBuilderTest.scala b/sc/shared/src/test/scala/sigmastate/lang/SigmaBuilderTest.scala similarity index 100% rename from sc/src/test/scala/sigmastate/lang/SigmaBuilderTest.scala rename to sc/shared/src/test/scala/sigmastate/lang/SigmaBuilderTest.scala diff --git a/sc/src/test/scala/sigmastate/lang/SigmaCompilerTest.scala b/sc/shared/src/test/scala/sigmastate/lang/SigmaCompilerTest.scala similarity index 100% rename from sc/src/test/scala/sigmastate/lang/SigmaCompilerTest.scala rename to sc/shared/src/test/scala/sigmastate/lang/SigmaCompilerTest.scala diff --git a/sc/src/test/scala/sigmastate/lang/SigmaTyperTest.scala b/sc/shared/src/test/scala/sigmastate/lang/SigmaTyperTest.scala similarity index 100% rename from sc/src/test/scala/sigmastate/lang/SigmaTyperTest.scala rename to sc/shared/src/test/scala/sigmastate/lang/SigmaTyperTest.scala diff --git a/sc/src/test/scala/sigmastate/serialization/DeserializationResilience.scala b/sc/shared/src/test/scala/sigmastate/serialization/DeserializationResilience.scala similarity index 100% rename from sc/src/test/scala/sigmastate/serialization/DeserializationResilience.scala rename to sc/shared/src/test/scala/sigmastate/serialization/DeserializationResilience.scala diff --git a/sc/src/test/scala/sigmastate/serialization/ErgoTreeSerializerSpecification.scala b/sc/shared/src/test/scala/sigmastate/serialization/ErgoTreeSerializerSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/serialization/ErgoTreeSerializerSpecification.scala rename to sc/shared/src/test/scala/sigmastate/serialization/ErgoTreeSerializerSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utils/GenInfoObjects.scala b/sc/shared/src/test/scala/sigmastate/utils/GenInfoObjects.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utils/GenInfoObjects.scala rename to sc/shared/src/test/scala/sigmastate/utils/GenInfoObjects.scala diff --git a/sc/src/test/scala/sigmastate/utils/SpecGen.scala b/sc/shared/src/test/scala/sigmastate/utils/SpecGen.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utils/SpecGen.scala rename to sc/shared/src/test/scala/sigmastate/utils/SpecGen.scala diff --git a/sc/src/test/scala/sigmastate/utxo/AVLTreeScriptsSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/AVLTreeScriptsSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/AVLTreeScriptsSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/AVLTreeScriptsSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/BasicOpsSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/BasicOpsSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/BasicOpsSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/BasicOpsSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/BlockchainSimulationSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/BlockchainSimulationSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/BlockchainSimulationSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/BlockchainSimulationSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/CollectionOperationsSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/CollectionOperationsSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/CollectionOperationsSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/CollectionOperationsSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/ComplexSigSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/ComplexSigSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/ComplexSigSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/ComplexSigSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/ContextEnrichingSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/ContextEnrichingSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/ContextEnrichingSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/ContextEnrichingSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/DistributedSigSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/DistributedSigSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/DistributedSigSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/DistributedSigSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/ErgoLikeInterpreterSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/ErgoLikeInterpreterSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/ErgoLikeInterpreterSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/ErgoLikeInterpreterSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/SerializationRoundTripSpec.scala b/sc/shared/src/test/scala/sigmastate/utxo/SerializationRoundTripSpec.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/SerializationRoundTripSpec.scala rename to sc/shared/src/test/scala/sigmastate/utxo/SerializationRoundTripSpec.scala diff --git a/sc/src/test/scala/sigmastate/utxo/SigmaCompilerSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/SigmaCompilerSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/SigmaCompilerSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/SigmaCompilerSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/ThresholdSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/ThresholdSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/ThresholdSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/ThresholdSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/UsingContextPropertiesSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/UsingContextPropertiesSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/UsingContextPropertiesSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/UsingContextPropertiesSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/blockchain/BlockchainSimulationSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/blockchain/BlockchainSimulationSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/blockchain/BlockchainSimulationSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/blockchain/BlockchainSimulationSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/blockchain/BlockchainSimulationTestingCommons.scala b/sc/shared/src/test/scala/sigmastate/utxo/blockchain/BlockchainSimulationTestingCommons.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/blockchain/BlockchainSimulationTestingCommons.scala rename to sc/shared/src/test/scala/sigmastate/utxo/blockchain/BlockchainSimulationTestingCommons.scala diff --git a/sc/src/test/scala/sigmastate/utxo/examples/AssetsAtomicExchange.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/AssetsAtomicExchange.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/examples/AssetsAtomicExchange.scala rename to sc/shared/src/test/scala/sigmastate/utxo/examples/AssetsAtomicExchange.scala diff --git a/sc/src/test/scala/sigmastate/utxo/examples/AssetsAtomicExchangeErgoTests.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/AssetsAtomicExchangeErgoTests.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/examples/AssetsAtomicExchangeErgoTests.scala rename to sc/shared/src/test/scala/sigmastate/utxo/examples/AssetsAtomicExchangeErgoTests.scala diff --git a/sc/src/test/scala/sigmastate/utxo/examples/AssetsAtomicExchangeTests.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/AssetsAtomicExchangeTests.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/examples/AssetsAtomicExchangeTests.scala rename to sc/shared/src/test/scala/sigmastate/utxo/examples/AssetsAtomicExchangeTests.scala diff --git a/sc/src/test/scala/sigmastate/utxo/examples/AssetsPartialFilling.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/AssetsPartialFilling.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/examples/AssetsPartialFilling.scala rename to sc/shared/src/test/scala/sigmastate/utxo/examples/AssetsPartialFilling.scala diff --git a/sc/src/test/scala/sigmastate/utxo/examples/AtomicSwapExampleSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/AtomicSwapExampleSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/examples/AtomicSwapExampleSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/examples/AtomicSwapExampleSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/examples/CoinEmissionSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/CoinEmissionSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/examples/CoinEmissionSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/examples/CoinEmissionSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/examples/ColdWalletAdvContractExampleSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/ColdWalletAdvContractExampleSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/examples/ColdWalletAdvContractExampleSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/examples/ColdWalletAdvContractExampleSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/examples/ColdWalletContractExampleSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/ColdWalletContractExampleSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/examples/ColdWalletContractExampleSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/examples/ColdWalletContractExampleSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/examples/CoopExampleSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/CoopExampleSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/examples/CoopExampleSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/examples/CoopExampleSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/examples/CrowdFunding.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/CrowdFunding.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/examples/CrowdFunding.scala rename to sc/shared/src/test/scala/sigmastate/utxo/examples/CrowdFunding.scala diff --git a/sc/src/test/scala/sigmastate/utxo/examples/CrowdFundingTests.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/CrowdFundingTests.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/examples/CrowdFundingTests.scala rename to sc/shared/src/test/scala/sigmastate/utxo/examples/CrowdFundingTests.scala diff --git a/sc/src/test/scala/sigmastate/utxo/examples/DHTupleExampleSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/DHTupleExampleSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/examples/DHTupleExampleSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/examples/DHTupleExampleSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/examples/DemurrageExampleSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/DemurrageExampleSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/examples/DemurrageExampleSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/examples/DemurrageExampleSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/examples/DummyExamplesSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/DummyExamplesSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/examples/DummyExamplesSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/examples/DummyExamplesSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/examples/ExecuteFromExamplesSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/ExecuteFromExamplesSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/examples/ExecuteFromExamplesSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/examples/ExecuteFromExamplesSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/examples/FsmExampleSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/FsmExampleSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/examples/FsmExampleSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/examples/FsmExampleSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/examples/IcoExample.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/IcoExample.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/examples/IcoExample.scala rename to sc/shared/src/test/scala/sigmastate/utxo/examples/IcoExample.scala diff --git a/sc/src/test/scala/sigmastate/utxo/examples/LetsSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/LetsSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/examples/LetsSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/examples/LetsSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/examples/MASTExampleSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/MASTExampleSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/examples/MASTExampleSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/examples/MASTExampleSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/examples/MixExampleSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/MixExampleSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/examples/MixExampleSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/examples/MixExampleSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/examples/OracleDataInputsExamplesSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/OracleDataInputsExamplesSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/examples/OracleDataInputsExamplesSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/examples/OracleDataInputsExamplesSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/examples/OracleExamplesSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/OracleExamplesSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/examples/OracleExamplesSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/examples/OracleExamplesSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/examples/OracleTokenExamplesSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/OracleTokenExamplesSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/examples/OracleTokenExamplesSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/examples/OracleTokenExamplesSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/examples/RPSGameExampleSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/RPSGameExampleSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/examples/RPSGameExampleSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/examples/RPSGameExampleSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/examples/RevenueSharingExamplesSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/RevenueSharingExamplesSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/examples/RevenueSharingExamplesSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/examples/RevenueSharingExamplesSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/examples/ReversibleTxExampleSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/ReversibleTxExampleSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/examples/ReversibleTxExampleSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/examples/ReversibleTxExampleSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/examples/Rule110Specification.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/Rule110Specification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/examples/Rule110Specification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/examples/Rule110Specification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/examples/TimedPaymentExampleSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/TimedPaymentExampleSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/examples/TimedPaymentExampleSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/examples/TimedPaymentExampleSpecification.scala diff --git a/sc/src/test/scala/sigmastate/utxo/examples/TrustlessLETS.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/TrustlessLETS.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/examples/TrustlessLETS.scala rename to sc/shared/src/test/scala/sigmastate/utxo/examples/TrustlessLETS.scala diff --git a/sc/src/test/scala/sigmastate/utxo/examples/XorGameExampleSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/XorGameExampleSpecification.scala similarity index 100% rename from sc/src/test/scala/sigmastate/utxo/examples/XorGameExampleSpecification.scala rename to sc/shared/src/test/scala/sigmastate/utxo/examples/XorGameExampleSpecification.scala diff --git a/sc/src/test/scala/special/sigma/DataValueComparerSpecification.scala b/sc/shared/src/test/scala/special/sigma/DataValueComparerSpecification.scala similarity index 100% rename from sc/src/test/scala/special/sigma/DataValueComparerSpecification.scala rename to sc/shared/src/test/scala/special/sigma/DataValueComparerSpecification.scala diff --git a/sc/src/test/scala/special/sigma/LoopTests.scala b/sc/shared/src/test/scala/special/sigma/LoopTests.scala similarity index 100% rename from sc/src/test/scala/special/sigma/LoopTests.scala rename to sc/shared/src/test/scala/special/sigma/LoopTests.scala diff --git a/sc/src/test/scala/special/sigma/SigmaDslSpecification.scala b/sc/shared/src/test/scala/special/sigma/SigmaDslSpecification.scala similarity index 100% rename from sc/src/test/scala/special/sigma/SigmaDslSpecification.scala rename to sc/shared/src/test/scala/special/sigma/SigmaDslSpecification.scala diff --git a/sc/src/test/scala/special/sigma/SigmaDslStaginTests.scala b/sc/shared/src/test/scala/special/sigma/SigmaDslStaginTests.scala similarity index 93% rename from sc/src/test/scala/special/sigma/SigmaDslStaginTests.scala rename to sc/shared/src/test/scala/special/sigma/SigmaDslStaginTests.scala index afbd3ba4bb..40e53bd860 100644 --- a/sc/src/test/scala/special/sigma/SigmaDslStaginTests.scala +++ b/sc/shared/src/test/scala/special/sigma/SigmaDslStaginTests.scala @@ -1,11 +1,11 @@ package special.sigma -import org.scalatest.{BeforeAndAfter, BeforeAndAfterAll} +import org.scalatest.{BeforeAndAfterAll} import special.collection._ import scala.language.reflectiveCalls import scalan.{BaseCtxTests, BaseLiftableTests} -import sigmastate.{VersionContext, eval, TrivialProp, ReflectionGenerator} +import sigmastate.{VersionContext, eval, TrivialProp} import sigmastate.eval.Extensions._ import sigmastate.eval._ diff --git a/sc/src/test/scala/special/sigma/SigmaDslTesting.scala b/sc/shared/src/test/scala/special/sigma/SigmaDslTesting.scala similarity index 100% rename from sc/src/test/scala/special/sigma/SigmaDslTesting.scala rename to sc/shared/src/test/scala/special/sigma/SigmaDslTesting.scala diff --git a/sc/src/test/scala/thelastpackage/ZLastSpec.scala b/sc/shared/src/test/scala/thelastpackage/ZLastSpec.scala similarity index 94% rename from sc/src/test/scala/thelastpackage/ZLastSpec.scala rename to sc/shared/src/test/scala/thelastpackage/ZLastSpec.scala index c714036f50..377af4219f 100644 --- a/sc/src/test/scala/thelastpackage/ZLastSpec.scala +++ b/sc/shared/src/test/scala/thelastpackage/ZLastSpec.scala @@ -2,7 +2,6 @@ package thelastpackage import org.scalatest.BeforeAndAfterAll import org.scalatest.propspec.AnyPropSpec -import sigmastate.ReflectionGenerator /** This spec is the last in queue for execution when running all the tests. * It is thus useful to do something after all the tests have been executed. From 2e2ba7263b4566e39cc5f62712d6b3bd49bc580b Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Wed, 14 Jun 2023 21:27:05 +0200 Subject: [PATCH 06/58] compiler-js: configure sc.js to fix tests running --- build.sbt | 43 +++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/build.sbt b/build.sbt index 6f1debda63..125dfbb4cc 100644 --- a/build.sbt +++ b/build.sbt @@ -15,9 +15,12 @@ lazy val commonSettings = Seq( organization := "org.scorexfoundation", scalacOptions ++= { CrossVersion.partialVersion(scalaVersion.value) match { - case Some((2, 13)) => Seq("-Ywarn-unused:_,imports", "-Ywarn-unused:imports", "-release", "8") - case Some((2, 12)) => Seq("-Ywarn-unused:_,imports", "-Ywarn-unused:imports", "-release", "8") - case Some((2, 11)) => Seq() + case Some((2, 13)) => + Seq("-Ywarn-unused:_,imports", "-Ywarn-unused:imports", "-release", "8") + case Some((2, 12)) => + Seq("-Ywarn-unused:_,imports", "-Ywarn-unused:imports", "-release", "8") + case Some((2, 11)) => + Seq() case _ => sys.error("Unsupported scala version") } }, @@ -191,8 +194,14 @@ lazy val common = crossProject(JVMPlatform, JSPlatform) .jvmSettings( crossScalaSettings ) .jsSettings( crossScalaSettingsJS, + scalacOptions ++= Seq( + // Suppress warning about the global execution context in Scala.js is based on JS + // Promises (microtasks). Using it may prevent macrotasks (I/O, timers, UI + // rendering) from running fairly. + "-P:scalajs:nowarnGlobalExecutionContext" + ), libraryDependencies ++= Seq( - "org.scala-js" %%% "scala-js-macrotask-executor" % "1.0.0" + "org.scala-js" %%% "scala-js-macrotask-executor" % "1.1.1" ), useYarn := true ) @@ -244,7 +253,8 @@ lazy val graphirJS = graphir.js lazy val interpreter = crossProject(JVMPlatform, JSPlatform) .in(file("interpreter")) .dependsOn(corelib % allConfigDependency) - .settings(commonSettings ++ testSettings2, + .settings( + commonSettings ++ testSettings2, commonDependenies2, testingDependencies2, scorexUtilDependency, fastparseDependency, circeDependency, @@ -276,9 +286,11 @@ lazy val interpreterJS = interpreter.js lazy val parsers = crossProject(JVMPlatform, JSPlatform) .in(file("parsers")) .dependsOn(interpreter % allConfigDependency) - .settings(libraryDefSettings) .settings( - libraryDependencies ++= Seq(scorexUtil, fastparse) ++ circeDeps(scalaVersion.value), + commonSettings ++ testSettings2, + commonDependenies2, + testingDependencies2, + scorexUtilDependency, fastparseDependency, circeDependency, publish / skip := true ) .jvmSettings( @@ -293,6 +305,14 @@ lazy val parsers = crossProject(JVMPlatform, JSPlatform) ) lazy val parsersJS = parsers.js .enablePlugins(ScalaJSBundlerPlugin) + .settings( + scalaJSLinkerConfig ~= { conf => + conf.withSourceMap(false) + }, + Compile / npmDependencies ++= Seq( + "sigmajs-crypto-facade" -> sigmajsCryptoFacadeVersion + ) + ) lazy val sc = crossProject(JVMPlatform, JSPlatform) .in(file("sc")) @@ -301,13 +321,16 @@ lazy val sc = crossProject(JVMPlatform, JSPlatform) interpreter % allConfigDependency, parsers % allConfigDependency ) - .settings(libraryDefSettings) .settings( - libraryDependencies ++= Seq(scorexUtil, fastparse) ++ circeDeps(scalaVersion.value) + commonSettings ++ testSettings2, + commonDependenies2, + testingDependencies2, + scorexUtilDependency, fastparseDependency, circeDependency, ) .settings(publish / skip := true) .jvmSettings( - crossScalaSettings + crossScalaSettings, + libraryDependencies ++= Seq(scalameter) ) .jsSettings( crossScalaSettingsJS, From c64af30e8a0228544efa936a53f9a62ec3d142c1 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Wed, 14 Jun 2023 21:32:23 +0200 Subject: [PATCH 07/58] compiler-js: some cleanups to avoid warnings --- .../scala/scalan/reflection/JavaImpl.scala | 8 +- .../scala/scalan/reflection/Platform.scala | 26 +- .../src/main/scala/scalan/TypeDesc.scala | 5 +- .../scala/scalan/util/CollectionUtil.scala | 20 +- .../main/scala/scalan/util/Extensions.scala | 1 - .../scala/scalan/util/ReflectionUtil.scala | 11 - .../sigmastate/kiama/rewriting/Rewriter.scala | 24 +- .../scala/scalan/util/BenchmarkUtil.scala | 6 +- .../scalan/util/CollectionUtilTests.scala | 5 +- .../scala/special/CoreLibReflection.scala | 100 +++---- .../main/scala/special/collection/Colls.scala | 4 +- .../special/collection/CollsOverArrays.scala | 2 +- .../scala/special/collection/package.scala | 2 - .../src/test/scala/special/TypesTests.scala | 4 - .../scala/special/collections/CollGens.scala | 11 +- .../special/collections/CollsTests.scala | 7 +- .../js/src/test/scala/scalan/Platform.scala | 4 + .../jvm/src/test/scala/scalan/Platform.scala | 4 + .../src/main/scala/scalan/TypeDescs.scala | 4 +- .../sigmastate/ReflectionGenerator.scala | 5 +- .../ErgoAddressSpecification.scala | 4 +- .../ErgoLikeTransactionSpec.scala | 1 - .../org/ergoplatform/ErgoTreePredefSpec.scala | 4 +- .../scala/sigmastate/CompilerTestsBase.scala | 2 +- .../scala/sigmastate/FailingToProveSpec.scala | 4 +- .../SoftForkabilitySpecification.scala | 10 +- .../scala/sigmastate/TypesSpecification.scala | 23 +- .../sigmastate/eval/ErgoScriptTestkit.scala | 23 +- .../BlockchainSimulationSpecification.scala | 246 ------------------ .../BlockchainSimulationSpecification.scala | 43 --- .../examples/CoopExampleSpecification.scala | 6 +- .../scala/special/sigma/SigmaDslTesting.scala | 7 +- 32 files changed, 160 insertions(+), 466 deletions(-) delete mode 100644 common/shared/src/main/scala/scalan/util/ReflectionUtil.scala delete mode 100644 sc/shared/src/test/scala/sigmastate/utxo/BlockchainSimulationSpecification.scala diff --git a/common/jvm/src/main/scala/scalan/reflection/JavaImpl.scala b/common/jvm/src/main/scala/scalan/reflection/JavaImpl.scala index d5629ec4d1..f5de4ccadd 100644 --- a/common/jvm/src/main/scala/scalan/reflection/JavaImpl.scala +++ b/common/jvm/src/main/scala/scalan/reflection/JavaImpl.scala @@ -24,7 +24,7 @@ class JRClass[T](val value: Class[T]) extends RClass[T] { val methods = TrieMap.empty[(String, Seq[Class[_]]), RMethod] override def getMethod(name: String, parameterTypes: Class[_]*): RMethod = { - memoize(methods)((name, parameterTypes), JRMethod(this, value.getMethod(name, parameterTypes:_*))) + memoize(methods)((name, parameterTypes), JRMethod(value.getMethod(name, parameterTypes:_*))) } override def getSimpleName: String = value.getSimpleName @@ -62,7 +62,7 @@ class JRClass[T](val value: Class[T]) extends RClass[T] { override def isAssignableFrom(cls: Class[_]): Boolean = value.isAssignableFrom(cls) - override def getDeclaredMethods(): Array[RMethod] = value.getDeclaredMethods.map(JRMethod(this, _)) + override def getDeclaredMethods(): Array[RMethod] = value.getDeclaredMethods.map(JRMethod(_)) override def equals(other: Any): Boolean = (this eq other.asInstanceOf[AnyRef]) || (other match { case that: JRClass[_] => @@ -133,7 +133,7 @@ object JRConstructor { * @param declaringClass The JRClass that declares this method. * @param value The [[java.lang.reflect.Method]] instance that this JRMethod represents. */ -class JRMethod private (declaringClass: JRClass[_], val value: Method) extends RMethod { +class JRMethod private (val value: Method) extends RMethod { override def invoke(obj: Any, args: AnyRef*): AnyRef = { // val name = value.getName // val parameterTypes: Seq[Class[_]] = value.getParameterTypes @@ -156,5 +156,5 @@ class JRMethod private (declaringClass: JRClass[_], val value: Method) extends R override def toString: String = s"JRMethod($value)" } object JRMethod { - private[reflection] def apply(clazz: JRClass[_], value: Method): RMethod = new JRMethod(clazz, value) + private[reflection] def apply(value: Method): RMethod = new JRMethod(value) } diff --git a/common/jvm/src/main/scala/scalan/reflection/Platform.scala b/common/jvm/src/main/scala/scalan/reflection/Platform.scala index 5b3a7970cf..7088a4ae1a 100644 --- a/common/jvm/src/main/scala/scalan/reflection/Platform.scala +++ b/common/jvm/src/main/scala/scalan/reflection/Platform.scala @@ -1,8 +1,6 @@ package scalan.reflection -import scalan.util.ReflectionUtil.isSpecialChar - import scala.collection.concurrent.TrieMap /** Platform dependent implementation of reflection methods. */ @@ -16,16 +14,6 @@ object Platform { /** Thread-safe storage of class information. */ private val classes = TrieMap.empty[Class[_], JRClass[_]] - /** Check class registration. Should be used only for debugging. */ - private def checkRegisteredClass[T](clazz: Class[T]): Unit = { - CommonReflection.classes.get(clazz) match { - case Some(c) => - assert(c.clazz == clazz) - case _ => - sys.error(s"Cannot find RClass data for $clazz") - } - } - /** Returns an RClass instance for the given class. * * @param clazz The class for which to retrieve an RClass instance. @@ -38,6 +26,15 @@ object Platform { val cls = memoize(classes)(clazz, new JRClass[T](clazz)).asInstanceOf[JRClass[T]] // Uncomment the following lines to collect missing reflection data and generate Scala code for it // Should be used only for debugging and never in production. +// /** Check class registration. Should be used only for debugging. */ +// def checkRegisteredClass[T](clazz: Class[T]): Unit = { +// CommonReflection.classes.get(clazz) match { +// case Some(c) => +// assert(c.clazz == clazz) +// case _ => +// sys.error(s"Cannot find RClass data for $clazz") +// } +// } // try { // checkRegisteredClass(clazz) // } catch { @@ -66,6 +63,11 @@ object Platform { def getOrElseUpdate(key: K, value: => V): V = map.getOrElseUpdate(key, value) } + /** Special character in the name. */ + private def isSpecialChar(c: Char): Boolean = { + ('0' <= c && c <= '9') || c == '$' + } + /** Safe version of `getSimpleName` that works around a bug in Scala compilers 2.11, 2.12. * This method is only used for debugging and testing purposes. * diff --git a/common/shared/src/main/scala/scalan/TypeDesc.scala b/common/shared/src/main/scala/scalan/TypeDesc.scala index 7020cd40ae..c7578a2ea8 100644 --- a/common/shared/src/main/scala/scalan/TypeDesc.scala +++ b/common/shared/src/main/scala/scalan/TypeDesc.scala @@ -1,7 +1,7 @@ package scalan import scala.reflect.ClassTag -import scala.annotation.implicitNotFound +import scala.annotation.{implicitNotFound, unused} import scala.language.implicitConversions /** Base type for all runtime type descriptors. Sigma uses type descriptors to @@ -112,6 +112,7 @@ object RType { case class ArrayType[A](tA: RType[A]) extends RType[Array[A]] { val classTag: ClassTag[Array[A]] = { + @unused // avoid warning about unused ctA implicit val ctA: ClassTag[A] = tA.classTag scala.reflect.classTag[Array[A]] } @@ -122,6 +123,7 @@ object RType { case class OptionType[A](tA: RType[A]) extends RType[Option[A]] { val classTag: ClassTag[Option[A]] = { + @unused // avoid warning about unused ctA implicit val ctA: ClassTag[A] = tA.classTag scala.reflect.classTag[Option[A]] } @@ -135,6 +137,7 @@ object RType { case class ThunkType[A](tA: RType[A]) extends RType[ThunkData[A]] { val classTag: ClassTag[ThunkData[A]] = { + @unused // avoid warning about unused ctA implicit val ctA: ClassTag[A] = tA.classTag scala.reflect.classTag[ThunkData[A]] } diff --git a/common/shared/src/main/scala/scalan/util/CollectionUtil.scala b/common/shared/src/main/scala/scalan/util/CollectionUtil.scala index 10042b5b78..b9b79dd65c 100644 --- a/common/shared/src/main/scala/scalan/util/CollectionUtil.scala +++ b/common/shared/src/main/scala/scalan/util/CollectionUtil.scala @@ -13,15 +13,15 @@ object CollectionUtil { def concatArrays[T](xs: Array[T], ys: Array[T]): Array[T] = { val len = xs.length + ys.length val result = (xs match { - case arr: Array[AnyRef] => new Array[AnyRef](len) // creates an array with invalid type descriptor (i.e. when T == Tuple2) - case arr: Array[Byte] => new Array[Byte](len) - case arr: Array[Short] => new Array[Short](len) - case arr: Array[Int] => new Array[Int](len) - case arr: Array[Long] => new Array[Long](len) - case arr: Array[Char] => new Array[Char](len) - case arr: Array[Float] => new Array[Float](len) - case arr: Array[Double] => new Array[Double](len) - case arr: Array[Boolean] => new Array[Boolean](len) + case _: Array[AnyRef] => new Array[AnyRef](len) // creates an array with invalid type descriptor (i.e. when T == Tuple2) + case _: Array[Byte] => new Array[Byte](len) + case _: Array[Short] => new Array[Short](len) + case _: Array[Int] => new Array[Int](len) + case _: Array[Long] => new Array[Long](len) + case _: Array[Char] => new Array[Char](len) + case _: Array[Float] => new Array[Float](len) + case _: Array[Double] => new Array[Double](len) + case _: Array[Boolean] => new Array[Boolean](len) }).asInstanceOf[Array[T]] Array.copy(xs, 0, result, 0, xs.length) Array.copy(ys, 0, result, xs.length, ys.length) @@ -177,7 +177,7 @@ object CollectionUtil { * @return original collection `xs` casted to Source[B] * @throws java.lang.AssertionError if at least one item cannot be cast to `B` */ - def cast[B:ClassTag](implicit cbf: BuildFrom[Source[A], B, Source[B]]): Source[B] = { + def cast[B:ClassTag]: Source[B] = { for (x <- xs) { assert(x match { case _: B => true case _ => false}, s"Value $x doesn't conform to type ${reflect.classTag[B]}") } diff --git a/common/shared/src/main/scala/scalan/util/Extensions.scala b/common/shared/src/main/scala/scalan/util/Extensions.scala index 00ee2f10dd..457a60a72e 100644 --- a/common/shared/src/main/scala/scalan/util/Extensions.scala +++ b/common/shared/src/main/scala/scalan/util/Extensions.scala @@ -2,7 +2,6 @@ package scalan.util import java.math.BigInteger import java.nio.ByteBuffer -import scala.language.higherKinds object Extensions { implicit class BooleanOps(val b: Boolean) extends AnyVal { diff --git a/common/shared/src/main/scala/scalan/util/ReflectionUtil.scala b/common/shared/src/main/scala/scalan/util/ReflectionUtil.scala deleted file mode 100644 index 73a49d3ff8..0000000000 --- a/common/shared/src/main/scala/scalan/util/ReflectionUtil.scala +++ /dev/null @@ -1,11 +0,0 @@ -package scalan.util - -import scala.language.existentials - -object ReflectionUtil { - /** Special character in the name. */ - def isSpecialChar(c: Char): Boolean = { - ('0' <= c && c <= '9') || c == '$' - } - -} diff --git a/common/shared/src/main/scala/sigmastate/kiama/rewriting/Rewriter.scala b/common/shared/src/main/scala/sigmastate/kiama/rewriting/Rewriter.scala index c20347a3c9..8a1711c9d7 100644 --- a/common/shared/src/main/scala/sigmastate/kiama/rewriting/Rewriter.scala +++ b/common/shared/src/main/scala/sigmastate/kiama/rewriting/Rewriter.scala @@ -13,8 +13,6 @@ package rewriting import scalan.reflection.{Platform, RClass, RConstructor} -import scala.collection.concurrent.TrieMap - /** * Strategy-based term rewriting in the style of Stratego (http://strategoxt.org/). * The implementation here is partially based on the semantics given in "Program @@ -104,7 +102,7 @@ trait Rewriter { (t : Any) => { val of = anyf andThen (_ => Some(t)) try { - of.applyOrElse(t, (a : Any) => None) + of.applyOrElse(t, (_ : Any) => None) } catch { case _ : ClassCastException => None @@ -129,7 +127,7 @@ trait Rewriter { mkStrategy( (t : Any) => try { - of.applyOrElse(t, (a : Any) => None) + of.applyOrElse(t, (_ : Any) => None) } catch { case _ : ClassCastException => None @@ -158,7 +156,7 @@ trait Rewriter { (t : Any) => { val of = anyf andThen (_.apply(t)) try { - of.applyOrElse(t, (a : Any) => None) + of.applyOrElse(t, (_ : Any) => None) } catch { case _ : ClassCastException => None @@ -184,7 +182,7 @@ trait Rewriter { mkStrategy( (t : Any) => try { - of.applyOrElse(t, (a : Any) => None) + of.applyOrElse(t, (_ : Any) => None) } catch { case _ : ClassCastException => None @@ -243,7 +241,7 @@ trait Rewriter { // are trying to duplicate one of these then we want to return the same // singleton so we use an identity duper. clazz.getField("MODULE$") - (t : Any, children : Array[AnyRef]) => t + (t : Any, _ : Array[AnyRef]) => t } catch { // Otherwise, this is a normal class, so we try to make a // duper that uses the first constructor. @@ -252,7 +250,7 @@ trait Rewriter { if (ctors.length == 0) sys.error(s"dup no constructors for ${clazz.getName}") else - (t : Any, children : Array[AnyRef]) => + (_ : Any, children : Array[AnyRef]) => makeInstance(ctors(0), children) } @@ -261,7 +259,7 @@ trait Rewriter { try { ctor.newInstance(unboxPrimitives(ctor, children) : _*) } catch { - case e : IllegalArgumentException => + case _ : IllegalArgumentException => sys.error(s"""dup illegal arguments: $ctor got (${children.mkString(",")}) |Common cause: term classes are nested in another class, move them to the top level""".stripMargin) } @@ -508,7 +506,7 @@ trait Rewriter { t.foldLeft((false, 0)) { case ((changed, i), ct) => s(ct) match { - case Some(ti @ (tix, tiy)) => + case Some(ti @ (_, _)) => b += ti (changed || !same(ct, ti), i + 1) case _ => @@ -616,9 +614,9 @@ trait Rewriter { case (add, ct) => if (add) s(ct) match { - case Some(ti @ (tix, tiy)) if same(ct, ti) => + case Some(ti @ (_, _)) if same(ct, ti) => return Some(t) - case Some(ti @ (tix, tiy)) => + case Some(ti @ (_, _)) => b += ti false case Some(ti) => @@ -745,7 +743,7 @@ trait Rewriter { t.foldLeft((false, false)) { case ((success, changed), ct) => s(ct) match { - case Some(ti @ (tix, tiy)) => + case Some(ti @ (_, _)) => b += ti (true, changed || !same(ct, ti)) case _ => diff --git a/common/shared/src/test/scala/scalan/util/BenchmarkUtil.scala b/common/shared/src/test/scala/scalan/util/BenchmarkUtil.scala index 59cc68a37f..8a55512ae4 100644 --- a/common/shared/src/test/scala/scalan/util/BenchmarkUtil.scala +++ b/common/shared/src/test/scala/scalan/util/BenchmarkUtil.scala @@ -2,7 +2,7 @@ package scalan.util import debox.cfor -import scala.concurrent.{Future, Await} +import scala.concurrent.{Await, Future} import scala.concurrent.duration.Duration import scala.concurrent.ExecutionContext.Implicits.global @@ -15,7 +15,7 @@ object BenchmarkUtil { var sum = 0L cfor(0)(_ < nIters, _ + 1) { i => val start = System.currentTimeMillis() - val res = action(i) + action(i) val end = System.currentTimeMillis() val iterTime = end - start if (okShowIterTime) @@ -44,7 +44,7 @@ object BenchmarkUtil { def runTasks(nTasks: Int)(block: Int => Unit) = { val (_, total) = measureTime { val tasks = (1 to nTasks).map(iTask => Future(block(iTask))) - val res = Await.result(Future.sequence(tasks), Duration.Inf) + Await.result(Future.sequence(tasks), Duration.Inf) } println(s"Completed $nTasks tasks in $total msec") } diff --git a/common/shared/src/test/scala/scalan/util/CollectionUtilTests.scala b/common/shared/src/test/scala/scalan/util/CollectionUtilTests.scala index 457bef4436..2b394755aa 100644 --- a/common/shared/src/test/scala/scalan/util/CollectionUtilTests.scala +++ b/common/shared/src/test/scala/scalan/util/CollectionUtilTests.scala @@ -7,7 +7,6 @@ import scala.reflect.ClassTag class CollectionUtilTests extends BaseTests { import scalan.util.CollectionUtil._ - import java.lang.{Byte => JByte, Integer} test("updateMany") { val xs: Seq[Byte] = Array[Byte](1,2,3) @@ -37,9 +36,9 @@ class CollectionUtilTests extends BaseTests { } def joinSeqs(l: Seq[Int], r: Seq[Int]) = - outerJoinSeqs(l, r)(l => l, r => r)((_,l) => l, (_,r) => r, (k,l,r) => l + r).map(_._2) + outerJoinSeqs(l, r)(l => l, r => r)((_,l) => l, (_,r) => r, (_,l,r) => l + r).map(_._2) def joinPairs(l: Seq[(String,Int)], r: Seq[(String,Int)]) = - outerJoinSeqs(l, r)(l => l._1, r => r._1)((_,l) => l._2, (_,r) => r._2, (k,l,r) => l._2 + r._2) + outerJoinSeqs(l, r)(l => l._1, r => r._1)((_,l) => l._2, (_,r) => r._2, (_,l,r) => l._2 + r._2) test("joinSeqs") { def key(p : (Int, String)): Int = p._1 diff --git a/core-lib/shared/src/main/scala/special/CoreLibReflection.scala b/core-lib/shared/src/main/scala/special/CoreLibReflection.scala index 7e52e53d37..53c8d34ddf 100644 --- a/core-lib/shared/src/main/scala/special/CoreLibReflection.scala +++ b/core-lib/shared/src/main/scala/special/CoreLibReflection.scala @@ -21,10 +21,10 @@ object CoreLibReflection { mkMethod(clazz, "$bar$bar", Array[Class[_]](classOf[SigmaProp])) { (obj, args) => obj.asInstanceOf[SigmaProp].$bar$bar(args(0).asInstanceOf[SigmaProp]) }, - mkMethod(clazz, "isValid", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "isValid", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[SigmaProp].isValid }, - mkMethod(clazz, "propBytes", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "propBytes", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[SigmaProp].propBytes }, mkMethod(clazz, "$amp$amp", Array[Class[_]](classOf[SigmaProp])) { (obj, args) => @@ -149,26 +149,26 @@ object CoreLibReflection { obj.asInstanceOf[AvlTree].update(args(0).asInstanceOf[Coll[(Coll[Byte], Coll[Byte])]], args(1).asInstanceOf[Coll[Byte]]) }, - mkMethod(clazz, "keyLength", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "keyLength", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[AvlTree].keyLength }, - mkMethod(clazz, "enabledOperations", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "enabledOperations", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[AvlTree].enabledOperations }, mkMethod(clazz, "updateDigest", Array[Class[_]](classOf[Coll[_]])) { (obj, args) => obj.asInstanceOf[AvlTree].updateDigest(args(0).asInstanceOf[Coll[Byte]]) }, - mkMethod(clazz, "digest", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "digest", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[AvlTree].digest }, mkMethod(clazz, "insert", Array[Class[_]](classOf[Coll[_]], classOf[Coll[_]])) { (obj, args) => obj.asInstanceOf[AvlTree].insert(args(0).asInstanceOf[Coll[(Coll[Byte], Coll[Byte])]], args(1).asInstanceOf[Coll[Byte]]) }, - mkMethod(clazz, "isRemoveAllowed", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "isRemoveAllowed", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[AvlTree].isRemoveAllowed }, - mkMethod(clazz, "valueLengthOpt", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "valueLengthOpt", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[AvlTree].valueLengthOpt }, mkMethod(clazz, "get", Array[Class[_]](classOf[Coll[_]], classOf[Coll[_]])) { (obj, args) => @@ -182,10 +182,10 @@ object CoreLibReflection { obj.asInstanceOf[AvlTree].contains(args(0).asInstanceOf[Coll[Byte]], args(1).asInstanceOf[Coll[Byte]]) }, - mkMethod(clazz, "isUpdateAllowed", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "isUpdateAllowed", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[AvlTree].isUpdateAllowed }, - mkMethod(clazz, "isInsertAllowed", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "isInsertAllowed", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[AvlTree].isInsertAllowed } ) @@ -195,28 +195,28 @@ object CoreLibReflection { { val clazz = classOf[Box] registerClassEntry(clazz, methods = Map( - mkMethod(clazz, "value", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "value", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Box].value }, - mkMethod(clazz, "id", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "id", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Box].id }, - mkMethod(clazz, "creationInfo", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "creationInfo", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Box].creationInfo }, - mkMethod(clazz, "bytes", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "bytes", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Box].bytes }, - mkMethod(clazz, "tokens", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "tokens", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Box].tokens }, mkMethod(clazz, "getReg", Array[Class[_]](classOf[Int], classOf[RType[_]])) { (obj, args) => obj.asInstanceOf[Box].getReg(args(0).asInstanceOf[Int])(args(1).asInstanceOf[RType[_]]) }, - mkMethod (clazz, "bytesWithoutRef", Array[Class[_]]()) { (obj, args) => + mkMethod (clazz, "bytesWithoutRef", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Box].bytesWithoutRef }, - mkMethod(clazz, "propositionBytes", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "propositionBytes", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Box].propositionBytes } ) @@ -226,37 +226,37 @@ object CoreLibReflection { { val clazz = classOf[Context] registerClassEntry(clazz, methods = Map( - mkMethod(clazz, "LastBlockUtxoRootHash", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "LastBlockUtxoRootHash", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Context].LastBlockUtxoRootHash }, - mkMethod(clazz, "dataInputs", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "dataInputs", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Context].dataInputs }, - mkMethod(clazz, "selfBoxIndex", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "selfBoxIndex", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Context].selfBoxIndex }, - mkMethod(clazz, "INPUTS", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "INPUTS", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Context].INPUTS }, - mkMethod(clazz, "minerPubKey", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "minerPubKey", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Context].minerPubKey }, - mkMethod(clazz, "HEIGHT", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "HEIGHT", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Context].HEIGHT }, - mkMethod(clazz, "OUTPUTS", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "OUTPUTS", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Context].OUTPUTS }, - mkMethod(clazz, "SELF", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "SELF", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Context].SELF }, - mkMethod(clazz, "preHeader", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "preHeader", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Context].preHeader }, mkMethod(clazz, "getVar", Array[Class[_]](classOf[Byte], classOf[RType[_]])) { (obj, args) => obj.asInstanceOf[Context].getVar(args(0).asInstanceOf[Byte])(args(1).asInstanceOf[RType[_]]) }, - mkMethod(clazz, "headers", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "headers", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Context].headers } ) @@ -272,10 +272,10 @@ object CoreLibReflection { mkMethod(clazz, "multiply", Array[Class[_]](classOf[GroupElement])) { (obj, args) => obj.asInstanceOf[GroupElement].multiply(args(0).asInstanceOf[GroupElement]) }, - mkMethod(clazz, "getEncoded", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "getEncoded", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[GroupElement].getEncoded }, - mkMethod(clazz, "negate", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "negate", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[GroupElement].negate } ) @@ -285,49 +285,49 @@ object CoreLibReflection { { val clazz = classOf[Header] registerClassEntry(clazz, methods = Map( - mkMethod(clazz, "minerPk", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "minerPk", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Header].minerPk }, - mkMethod(clazz, "powNonce", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "powNonce", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Header].powNonce }, - mkMethod(clazz, "transactionsRoot", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "transactionsRoot", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Header].transactionsRoot }, - mkMethod(clazz, "powOnetimePk", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "powOnetimePk", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Header].powOnetimePk }, - mkMethod(clazz, "nBits", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "nBits", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Header].nBits }, - mkMethod(clazz, "votes", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "votes", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Header].votes }, - mkMethod(clazz, "id", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "id", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Header].id }, - mkMethod(clazz, "version", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "version", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Header].version }, - mkMethod(clazz, "parentId", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "parentId", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Header].parentId }, - mkMethod(clazz, "timestamp", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "timestamp", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Header].timestamp }, - mkMethod(clazz, "height", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "height", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Header].height }, - mkMethod(clazz, "extensionRoot", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "extensionRoot", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Header].extensionRoot }, - mkMethod(clazz, "ADProofsRoot", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "ADProofsRoot", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Header].ADProofsRoot }, - mkMethod(clazz, "stateRoot", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "stateRoot", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Header].stateRoot }, - mkMethod(clazz, "powDistance", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "powDistance", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[Header].powDistance } ) @@ -337,25 +337,25 @@ object CoreLibReflection { { val clazz = classOf[PreHeader] registerClassEntry(clazz, methods = Map( - mkMethod(clazz, "minerPk", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "minerPk", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[PreHeader].minerPk }, - mkMethod(clazz, "votes", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "votes", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[PreHeader].votes }, - mkMethod(clazz, "nBits", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "nBits", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[PreHeader].nBits }, - mkMethod(clazz, "version", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "version", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[PreHeader].version }, - mkMethod(clazz, "timestamp", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "timestamp", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[PreHeader].timestamp }, - mkMethod(clazz, "parentId", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "parentId", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[PreHeader].parentId }, - mkMethod(clazz, "height", Array[Class[_]]()) { (obj, args) => + mkMethod(clazz, "height", Array[Class[_]]()) { (obj, _) => obj.asInstanceOf[PreHeader].height } ) diff --git a/core-lib/shared/src/main/scala/special/collection/Colls.scala b/core-lib/shared/src/main/scala/special/collection/Colls.scala index 555be23415..77620472ee 100644 --- a/core-lib/shared/src/main/scala/special/collection/Colls.scala +++ b/core-lib/shared/src/main/scala/special/collection/Colls.scala @@ -8,7 +8,7 @@ import scalan._ * @define colls collections * @tparam A the collection element type */ -abstract class Coll[@specialized A] { +trait Coll[@specialized A] { def builder: CollBuilder def toArray: Array[A] @@ -290,7 +290,7 @@ abstract class Coll[@specialized A] { } } -abstract class PairColl[@specialized L, @specialized R] extends Coll[(L,R)] { +trait PairColl[@specialized L, @specialized R] extends Coll[(L,R)] { def ls: Coll[L] def rs: Coll[R] def mapFirst[T1: RType](f: L => T1): Coll[(T1, R)] diff --git a/core-lib/shared/src/main/scala/special/collection/CollsOverArrays.scala b/core-lib/shared/src/main/scala/special/collection/CollsOverArrays.scala index 6f7c87695d..7b91c0f50b 100644 --- a/core-lib/shared/src/main/scala/special/collection/CollsOverArrays.scala +++ b/core-lib/shared/src/main/scala/special/collection/CollsOverArrays.scala @@ -8,7 +8,7 @@ import Helpers._ import debox.Buffer import scalan.RType._ import sigmastate.VersionContext -import sigmastate.util.{MaxArrayLength, safeConcatArrays_v5, safeNewArray} +import sigmastate.util.{MaxArrayLength, safeConcatArrays_v5} import debox.cfor class CollOverArray[@specialized A](val toArray: Array[A], val builder: CollBuilder) diff --git a/core-lib/shared/src/main/scala/special/collection/package.scala b/core-lib/shared/src/main/scala/special/collection/package.scala index 6a69271223..71658396c2 100644 --- a/core-lib/shared/src/main/scala/special/collection/package.scala +++ b/core-lib/shared/src/main/scala/special/collection/package.scala @@ -2,8 +2,6 @@ package special import scala.language.implicitConversions import scalan.RType -import scalan.reflection.CommonReflection.registerClassEntry -import scalan.reflection.SRMethod import scala.reflect.{classTag, ClassTag} diff --git a/core-lib/shared/src/test/scala/special/TypesTests.scala b/core-lib/shared/src/test/scala/special/TypesTests.scala index 16f6bc7150..13b562d84c 100644 --- a/core-lib/shared/src/test/scala/special/TypesTests.scala +++ b/core-lib/shared/src/test/scala/special/TypesTests.scala @@ -15,10 +15,6 @@ class TypesTests extends BaseTests { } test("RType implements equality") { - def test[A: RType, B: RType] = { - val x = RType[A]; val y = RType[B] - assert(x == y) - } def tuple = tupleRType(Array(RType[Int], RType[Long])) assert(tuple == tuple, "compare two different but equal instances") diff --git a/core-lib/shared/src/test/scala/special/collections/CollGens.scala b/core-lib/shared/src/test/scala/special/collections/CollGens.scala index 5c962cf2b9..858ce9f3f4 100644 --- a/core-lib/shared/src/test/scala/special/collections/CollGens.scala +++ b/core-lib/shared/src/test/scala/special/collections/CollGens.scala @@ -37,30 +37,29 @@ trait CollGens { testSuite => def getCollReplGen[T: RType]( lenGen: Gen[Int], - valGen: Gen[T], - count: Int = 100): Gen[Coll[T]] = { + valGen: Gen[T]): Gen[Coll[T]] = { for {l <- lenGen; v <- valGen} yield builder.replicate(l, v) } - def getCollPairGenFinal[A: RType, B: RType]( + def getCollPairGenFinal[A, B]( collGenLeft: Gen[Coll[A]], collGenRight: Gen[Coll[B]]): Gen[PairColl[A, B]] = { for {left <- collGenLeft; right <- collGenRight} yield builder.pairColl(left, right) } - def getCollPairGenRight[A: RType, B: RType, C: RType]( + def getCollPairGenRight[A, B, C]( collGenLeft: Gen[Coll[A]], collGenRight: Gen[PairColl[B, C]]): Gen[PairColl[A, (B, C)]] = { for {left <- collGenLeft; right <- collGenRight} yield builder.pairColl(left, right) } - def getCollPairGenLeft[A: RType, B: RType, C: RType]( + def getCollPairGenLeft[A, B, C]( collGenLeft: Gen[PairColl[A, B]], collGenRight: Gen[Coll[C]]): Gen[PairColl[(A, B), C]] = { for {left <- collGenLeft; right <- collGenRight} yield builder.pairColl(left, right) } - def getCollPairGenBoth[A: RType, B: RType, C: RType, D: RType]( + def getCollPairGenBoth[A, B, C, D]( collGenLeft: Gen[PairColl[A, B]], collGenRight: Gen[PairColl[C, D]]): Gen[PairColl[(A, B), (C, D)]] = { for {left <- collGenLeft; right <- collGenRight} yield builder.pairColl(left, right) diff --git a/core-lib/shared/src/test/scala/special/collections/CollsTests.scala b/core-lib/shared/src/test/scala/special/collections/CollsTests.scala index 0f75c0c27b..6e2271fd9e 100644 --- a/core-lib/shared/src/test/scala/special/collections/CollsTests.scala +++ b/core-lib/shared/src/test/scala/special/collections/CollsTests.scala @@ -9,7 +9,7 @@ import scalan._ import sigmastate.{VersionContext, VersionTestingProperty} import special.collection.{Coll, CollOverArray, PairOfCols} -import scala.language.{existentials, implicitConversions} +import scala.language.{existentials} class CollsTests extends AnyPropSpec with ScalaCheckPropertyChecks with Matchers with CollGens with VersionTestingProperty { testSuite => import Gen._ @@ -19,7 +19,7 @@ class CollsTests extends AnyPropSpec with ScalaCheckPropertyChecks with Matchers property("Coll.indices") { val minSuccess = MinSuccessful(30) - forAll(collGen, collGen, minSuccess) { (col1: Coll[Int], col2: Coll[Int]) => + forAll(collGen, collGen, minSuccess) { (col1: Coll[Int], _: Coll[Int]) => col1.indices.toArray shouldBe col1.toArray.indices.toArray } forAll(superGen, minSuccess) { cl => @@ -51,7 +51,6 @@ class CollsTests extends AnyPropSpec with ScalaCheckPropertyChecks with Matchers // The above equality should hold for all possible collection instances forAll(MinSuccessful(300)) { xs: Coll[Int] => - val arr = xs.toArray equalLength(xs) equalLengthMapped(xs, inc) @@ -474,7 +473,7 @@ class CollsTests extends AnyPropSpec with ScalaCheckPropertyChecks with Matchers checkColls(repl, coll) } // This tuple tests fail with previous implementation - forAll (byteGen, doubleGen, intGen, indexGen, minSuccess) { (b, d, i, n) => + forAll (byteGen, doubleGen, intGen, indexGen, minSuccess) { (b, _, i, n) => val repl = builder.replicate(n, (b, i)) val coll = builder.fromArray(Array.fill[(Byte, Int)](n)((b, i))) diff --git a/graph-ir/js/src/test/scala/scalan/Platform.scala b/graph-ir/js/src/test/scala/scalan/Platform.scala index 8d6deaebce..5ec15fa4ee 100644 --- a/graph-ir/js/src/test/scala/scalan/Platform.scala +++ b/graph-ir/js/src/test/scala/scalan/Platform.scala @@ -10,4 +10,8 @@ object Platform { @unused name: String, @unused sfs: Seq[() => scalan.Sym]): Unit = { } + + /** On JS it is no-operation. */ + def threadSleepOrNoOp(@unused millis: Long): Unit = { + } } diff --git a/graph-ir/jvm/src/test/scala/scalan/Platform.scala b/graph-ir/jvm/src/test/scala/scalan/Platform.scala index dca77ee0bb..fe49a80368 100644 --- a/graph-ir/jvm/src/test/scala/scalan/Platform.scala +++ b/graph-ir/jvm/src/test/scala/scalan/Platform.scala @@ -31,4 +31,8 @@ object Platform { Assertions.fail(s"Staging $name failed. $graphMsg", e) } } + + /** On JVM it calls Thread.sleep. */ + def threadSleepOrNoOp(millis: Long): Unit = + Thread.sleep(millis) } diff --git a/graph-ir/shared/src/main/scala/scalan/TypeDescs.scala b/graph-ir/shared/src/main/scala/scalan/TypeDescs.scala index c4ab35124b..48cb0a0dc9 100644 --- a/graph-ir/shared/src/main/scala/scalan/TypeDescs.scala +++ b/graph-ir/shared/src/main/scala/scalan/TypeDescs.scala @@ -1,12 +1,10 @@ package scalan -import scala.language.{implicitConversions, higherKinds} +import scala.language.{implicitConversions} import scala.annotation.implicitNotFound import scala.collection.immutable.ListMap import scalan.util._ import scalan.RType._ -import ReflectionUtil._ // don't remove - import scala.collection.mutable import debox.cfor import scalan.reflection.{RClass, RMethod, RConstructor} diff --git a/sc/jvm/src/test/scala/sigmastate/ReflectionGenerator.scala b/sc/jvm/src/test/scala/sigmastate/ReflectionGenerator.scala index c790cc3b42..ddb84b0904 100644 --- a/sc/jvm/src/test/scala/sigmastate/ReflectionGenerator.scala +++ b/sc/jvm/src/test/scala/sigmastate/ReflectionGenerator.scala @@ -3,6 +3,7 @@ package sigmastate import scalan.reflection._ import scalan.{Base, TypeDescs} +import scala.annotation.unused import scala.collection.mutable object ReflectionGenerator { @@ -19,7 +20,7 @@ object ReflectionGenerator { Class.forName(prefix) '.' // prefix is object } catch { - case t: Throwable => + case _: Throwable => '#' // prefix is not object } } @@ -95,7 +96,7 @@ object ReflectionGenerator { | }""".stripMargin } - def genField(c: JRClass[_], f: JRField): String = { + def genField(@unused c: JRClass[_], f: JRField): String = { f.toString } diff --git a/sc/shared/src/test/scala/org/ergoplatform/ErgoAddressSpecification.scala b/sc/shared/src/test/scala/org/ergoplatform/ErgoAddressSpecification.scala index 6d96582306..6b3c219aaa 100644 --- a/sc/shared/src/test/scala/org/ergoplatform/ErgoAddressSpecification.scala +++ b/sc/shared/src/test/scala/org/ergoplatform/ErgoAddressSpecification.scala @@ -9,7 +9,7 @@ import scorex.util.encode.Base58 import sigmastate.Values.{ByteArrayConstant, Constant, ErgoTree, IntConstant, UnparsedErgoTree} import sigmastate.basics.DLogProtocol import sigmastate.basics.DLogProtocol.{DLogProverInput, ProveDlog} -import sigmastate.eval.{IRContext, InvalidType} +import sigmastate.eval.InvalidType import sigmastate.helpers.TestingHelpers._ import sigmastate.helpers._ import sigmastate.interpreter.ContextExtension.VarBinding @@ -228,7 +228,7 @@ class ErgoAddressSpecification extends SigmaDslTesting } } - def testPay2SHAddress(address: Pay2SHAddress, scriptBytes: Array[Byte])(implicit IR: IRContext) = { + def testPay2SHAddress(address: Pay2SHAddress, scriptBytes: Array[Byte]) = { val scriptId = 1.toByte val boxToSpend = testBox(10, address.script, creationHeight = 5) val ctx = ErgoLikeContextTesting.dummy(boxToSpend, activatedVersionInTests) diff --git a/sc/shared/src/test/scala/org/ergoplatform/ErgoLikeTransactionSpec.scala b/sc/shared/src/test/scala/org/ergoplatform/ErgoLikeTransactionSpec.scala index 1ec9bd74db..c0c926c9a2 100644 --- a/sc/shared/src/test/scala/org/ergoplatform/ErgoLikeTransactionSpec.scala +++ b/sc/shared/src/test/scala/org/ergoplatform/ErgoLikeTransactionSpec.scala @@ -2,7 +2,6 @@ package org.ergoplatform import org.ergoplatform.ErgoBox.TokenId import org.ergoplatform.settings.ErgoAlgos -import scorex.crypto.hash.Digest32 import scorex.util.encode.Base16 import scorex.util.{Random, ModifierId} import sigmastate.SCollection.SByteArray diff --git a/sc/shared/src/test/scala/org/ergoplatform/ErgoTreePredefSpec.scala b/sc/shared/src/test/scala/org/ergoplatform/ErgoTreePredefSpec.scala index 81e6f1954c..86e7ab6b7f 100644 --- a/sc/shared/src/test/scala/org/ergoplatform/ErgoTreePredefSpec.scala +++ b/sc/shared/src/test/scala/org/ergoplatform/ErgoTreePredefSpec.scala @@ -5,7 +5,7 @@ import org.ergoplatform.ErgoBox.R4 import org.ergoplatform.mining.emission.EmissionRules import org.ergoplatform.settings.MonetarySettings import org.scalacheck.Gen -import scorex.crypto.hash.{Digest32, Blake2b256} +import scorex.crypto.hash.Blake2b256 import scorex.util.Random import sigmastate.Values.{SigmaPropConstant, CollectionConstant, ByteArrayConstant, IntConstant, ErgoTree} import sigmastate._ @@ -233,7 +233,7 @@ class ErgoTreePredefSpec extends CompilerTestingCommons with CompilerCrossVersio } - measure(10) { i => + measure(10) { _ => // transaction with the only input with enough token should pass val inputs0 = IndexedSeq( testBox(20, prop, 0, Seq((wrongId, tokenAmount), (tokenId, tokenAmount), (wrongId2, tokenAmount)), Map()) diff --git a/sc/shared/src/test/scala/sigmastate/CompilerTestsBase.scala b/sc/shared/src/test/scala/sigmastate/CompilerTestsBase.scala index 67abf7d0a9..cd7e15b841 100644 --- a/sc/shared/src/test/scala/sigmastate/CompilerTestsBase.scala +++ b/sc/shared/src/test/scala/sigmastate/CompilerTestsBase.scala @@ -49,7 +49,7 @@ trait CompilerTestsBase extends TestsBase { } /** Check the given [[CompilerResult]] meets equality and sanity requirements. */ - def checkCompilerResult[Ctx <: IRContext](res: CompilerResult[Ctx])(implicit IR: IRContext): Unit = { + def checkCompilerResult[Ctx <: IRContext](res: CompilerResult[Ctx]): Unit = { checkSerializationRoundTrip(res.buildTree) } diff --git a/sc/shared/src/test/scala/sigmastate/FailingToProveSpec.scala b/sc/shared/src/test/scala/sigmastate/FailingToProveSpec.scala index 0d2e68e54f..c48a9cd111 100644 --- a/sc/shared/src/test/scala/sigmastate/FailingToProveSpec.scala +++ b/sc/shared/src/test/scala/sigmastate/FailingToProveSpec.scala @@ -45,7 +45,7 @@ class FailingToProveSpec extends CompilerTestingCommons minerPubkey = ErgoLikeContextTesting.dummyPubkey, activatedVersion = activatedVersionInTests) val proof = interpreter.prove(emptyEnv + (ScriptNameProp -> "prove"), tree, ctx, fakeMessage).success.value.proof - verifier.verify(emptyEnv + (ScriptNameProp -> "verify"), tree, ctx, proof, fakeMessage) should be a 'success + verifier.verify(emptyEnv + (ScriptNameProp -> "verify"), tree, ctx, proof, fakeMessage) shouldBe 'success } property("successfully evaluate proof 2") { @@ -80,7 +80,7 @@ class FailingToProveSpec extends CompilerTestingCommons minerPubkey = ErgoLikeContextTesting.dummyPubkey, activatedVersion = activatedVersionInTests) val proof = interpreter.prove(emptyEnv + (ScriptNameProp -> "prove"), tree, ctx, fakeMessage).success.value.proof - verifier.verify(emptyEnv + (ScriptNameProp -> "verify"), tree, ctx, proof, fakeMessage) should be a 'success + verifier.verify(emptyEnv + (ScriptNameProp -> "verify"), tree, ctx, proof, fakeMessage) shouldBe 'success } } diff --git a/sc/shared/src/test/scala/sigmastate/SoftForkabilitySpecification.scala b/sc/shared/src/test/scala/sigmastate/SoftForkabilitySpecification.scala index 574f02328d..05f892c2be 100644 --- a/sc/shared/src/test/scala/sigmastate/SoftForkabilitySpecification.scala +++ b/sc/shared/src/test/scala/sigmastate/SoftForkabilitySpecification.scala @@ -6,11 +6,11 @@ import org.ergoplatform.validation._ import org.scalatest.BeforeAndAfterAll import sigmastate.SPrimType.MaxPrimTypeCode import sigmastate.Values.ErgoTree.EmptyConstants -import sigmastate.Values.{ByteArrayConstant, ErgoTree, IntConstant, NotReadyValueInt, Tuple, UnparsedErgoTree, ValueCompanion} +import sigmastate.Values.{ByteArrayConstant, ErgoTree, IntConstant, NotReadyValueInt, UnparsedErgoTree, ValueCompanion} import sigmastate.eval.Colls -import sigmastate.exceptions.{SerializerException, SigmaException, InterpreterException} +import sigmastate.exceptions.{InterpreterException, SerializerException} import sigmastate.helpers.TestingHelpers._ -import sigmastate.helpers.{ErgoLikeTestInterpreter, ErgoLikeContextTesting, ErgoLikeTestProvingInterpreter, CompilerTestingCommons} +import sigmastate.helpers.{CompilerTestingCommons, ErgoLikeContextTesting, ErgoLikeTestInterpreter, ErgoLikeTestProvingInterpreter} import sigmastate.interpreter.ErgoTreeEvaluator.DataEnv import sigmastate.interpreter.Interpreter.{ScriptNameProp, emptyEnv} import sigmastate.interpreter.{ContextExtension, ErgoTreeEvaluator, ProverResult} @@ -19,7 +19,7 @@ import sigmastate.serialization.OpCodes.{LastConstantCode, OpCode} import sigmastate.serialization.SigmaSerializer.startReader import sigmastate.serialization._ import sigmastate.utils.Helpers._ -import sigmastate.utxo.{DeserializeContext, SelectField} +import sigmastate.utxo.DeserializeContext import special.sigma.SigmaTestingData class SoftForkabilitySpecification extends SigmaTestingData @@ -157,7 +157,7 @@ class SoftForkabilitySpecification extends SigmaTestingData assertExceptionThrown({ ErgoTree(1.toByte, EmptyConstants, propV2) }, { - case e: IllegalArgumentException => true + case _: IllegalArgumentException => true case _ => false } ) diff --git a/sc/shared/src/test/scala/sigmastate/TypesSpecification.scala b/sc/shared/src/test/scala/sigmastate/TypesSpecification.scala index 5270ce8344..d492bc8220 100644 --- a/sc/shared/src/test/scala/sigmastate/TypesSpecification.scala +++ b/sc/shared/src/test/scala/sigmastate/TypesSpecification.scala @@ -1,19 +1,8 @@ package sigmastate -import java.math.BigInteger - -import org.ergoplatform.ErgoBox -import org.ergoplatform.settings.ErgoAlgos -import scalan.RType -import scorex.crypto.hash.Digest32 -import sigmastate.basics.{DLogProtocol, CryptoConstants} +import sigmastate.SType.isValueOfType +import sigmastate.eval.{CSigmaProp, CostingSigmaDslBuilder} import special.sigma.SigmaTestingData -import sigmastate.SType.{isValueOfType, AnyOps} -import sigmastate.Values.{ShortConstant, LongConstant, BigIntConstant, AvlTreeConstant, IntConstant, ByteConstant} -import sigmastate.eval.{CSigmaProp, SigmaDsl, CostingSigmaDslBuilder} -import special.collection.Coll -import special.sigma.BigInt -import sigmastate.helpers.TestingHelpers._ class TypesSpecification extends SigmaTestingData { @@ -32,10 +21,14 @@ class TypesSpecification extends SigmaTestingData { property("SType.isValueOfType test vectors") { def assertTrue(x: Any, t: SType) = { - isValueOfType(x, t) shouldBe true + withClue(s"x = $x, t = $t: ") { + isValueOfType(x, t) shouldBe true + } } def assertFalse(x: Any, t: SType) = { - isValueOfType(x, t) shouldBe false + withClue(s"x = $x, t = $t: ") { + isValueOfType(x, t) shouldBe false + } } assertTrue(true, SBoolean) diff --git a/sc/shared/src/test/scala/sigmastate/eval/ErgoScriptTestkit.scala b/sc/shared/src/test/scala/sigmastate/eval/ErgoScriptTestkit.scala index 1407be9dc3..efa0829d93 100644 --- a/sc/shared/src/test/scala/sigmastate/eval/ErgoScriptTestkit.scala +++ b/sc/shared/src/test/scala/sigmastate/eval/ErgoScriptTestkit.scala @@ -2,22 +2,21 @@ package sigmastate.eval import org.ergoplatform.ErgoAddressEncoder.TestnetNetworkPrefix import org.ergoplatform.validation.ValidationSpecification - -import scala.util.Success -import sigmastate.{VersionContext, CompilerTestsBase, SType, TestsBase, AvlTreeData} -import sigmastate.Values.{EvaluatedValue, SValue, SigmaPropConstant, Value, BigIntArrayConstant} import org.ergoplatform.{Context => _, _} import scalan.BaseCtxTests -import sigmastate.lang.{LangTests, CompilerResult, CompilerSettings, SigmaCompiler} -import sigmastate.helpers.{ContextEnrichingTestProvingInterpreter, ErgoLikeContextTesting} +import sigmastate.Values.{BigIntArrayConstant, EvaluatedValue, SValue, SigmaPropConstant, Value} import sigmastate.helpers.TestingHelpers._ -import sigmastate.interpreter.{ErgoTreeEvaluator, ContextExtension} +import sigmastate.helpers.{ContextEnrichingTestProvingInterpreter, ErgoLikeContextTesting} import sigmastate.interpreter.Interpreter.ScriptEnv +import sigmastate.interpreter.{ContextExtension, ErgoTreeEvaluator} import sigmastate.lang.Terms.ValueOps -import special.sigma.{ContractsTestkit, Context => DContext} +import sigmastate.lang.{CompilerResult, CompilerSettings, LangTests, SigmaCompiler} import sigmastate.serialization.ErgoTreeSerializer.DefaultSerializer +import sigmastate.{AvlTreeData, CompilerTestsBase, SType, VersionContext} +import special.sigma.{ContractsTestkit, Context => DContext} import scala.language.implicitConversions +import scala.util.Success trait ErgoScriptTestkit extends ContractsTestkit with LangTests with ValidationSpecification with CompilerTestsBase { self: BaseCtxTests => @@ -26,9 +25,9 @@ trait ErgoScriptTestkit extends ContractsTestkit with LangTests new TestContext with IRContext import IR._ - import Liftables._ - import Context._ import BigInt._ + import Context._ + import Liftables._ override lazy val compiler = new SigmaCompiler(CompilerSettings( TestnetNetworkPrefix, @@ -117,7 +116,9 @@ trait ErgoScriptTestkit extends ContractsTestkit with LangTests def checkExpected[T](block: => T, expected: Option[T], messageFmt: String) = { if (expected.isDefined) { val x = block - x shouldBe expected.get + withClue(messageFmt) { + x shouldBe expected.get + } } } diff --git a/sc/shared/src/test/scala/sigmastate/utxo/BlockchainSimulationSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/BlockchainSimulationSpecification.scala deleted file mode 100644 index d112ce45c3..0000000000 --- a/sc/shared/src/test/scala/sigmastate/utxo/BlockchainSimulationSpecification.scala +++ /dev/null @@ -1,246 +0,0 @@ -package sigmastate.utxo - -import java.io.{FileWriter, File} - -import org.ergoplatform -import org.ergoplatform.ErgoBox.Token -import org.ergoplatform._ -import org.scalacheck.Gen -import scorex.crypto.authds.avltree.batch.{Remove, BatchAVLProver, Insert} -import scorex.crypto.authds.{ADDigest, ADKey, ADValue} -import scorex.crypto.hash.{Digest32, Blake2b256} -import scorex.util._ -import sigmastate.Values.{LongConstant, IntConstant, ErgoTree} -import sigmastate.helpers.{ErgoTransactionValidator, ErgoLikeContextTesting, ErgoLikeTestProvingInterpreter, CompilerTestingCommons, BlockchainState} -import sigmastate.helpers.TestingHelpers._ -import sigmastate.interpreter.ContextExtension -import sigmastate.eval._ -import sigmastate.interpreter.Interpreter.{ScriptNameProp, emptyEnv} -import sigmastate.{GE, AvlTreeData, CompilerCrossVersionProps, AvlTreeFlags} - -import scala.annotation.tailrec -import scala.collection.concurrent.TrieMap -import scala.collection.mutable -import scala.util.Try - - -class BlockchainSimulationSpecification extends CompilerTestingCommons - with CompilerCrossVersionProps { - import BlockchainSimulationSpecification._ - implicit lazy val IR = new TestingIRContext - - def generateBlock(state: ValidationState, miner: ErgoLikeTestProvingInterpreter, height: Int): Block = { - val minerPubKey = miner.dlogSecrets.head.publicImage - val boxesToSpend = state.boxesReader.byHeightRegValue(height) - - val txs = boxesToSpend.map { box => - val newBoxCandidate = - new ErgoBoxCandidate(10, minerPubKey, height, Colls.emptyColl[Token], Map(heightReg -> IntConstant(height + windowSize))) - val unsignedInput = new UnsignedInput(box.id) - val tx = UnsignedErgoLikeTransaction(IndexedSeq(unsignedInput), IndexedSeq(newBoxCandidate)) - val context = ErgoLikeContextTesting(height + 1, - state.state.lastBlockUtxoRoot, - ErgoLikeContextTesting.dummyPubkey, - IndexedSeq(box), - tx, - box, - activatedVersionInTests, - ContextExtension.empty) - val env = emptyEnv + (ScriptNameProp -> s"height_${state.state.currentHeight}_prove") - val proverResult = miner.prove(env, box.ergoTree, context, tx.messageToSign).get - - tx.toSigned(IndexedSeq(proverResult)) - }.toIndexedSeq.ensuring(_.nonEmpty, s"Failed to create txs from boxes $boxesToSpend at height $height") - - Block(txs, minerPubKey.pkBytes) - } - - import ValidationState._ - - property("apply one valid block") { - val state = initialState(activatedVersionInTests, initBlock(ergoTreeVersionInTests)) - val miner = new ErgoLikeTestProvingInterpreter() - val block = generateBlock(state, miner, 0) - val updStateTry = state.applyBlock(block) - updStateTry.isSuccess shouldBe true - } - - property("too costly block") { - val state = initialState(activatedVersionInTests, initBlock(ergoTreeVersionInTests)) - val miner = new ErgoLikeTestProvingInterpreter() - val block = generateBlock(state, miner, 0) - val updStateTry = state.applyBlock(block, maxCost = 1) - updStateTry.isSuccess shouldBe false - } - - property("apply many blocks") { - val state = initialState(activatedVersionInTests, initBlock(ergoTreeVersionInTests)) - val miner = new ErgoLikeTestProvingInterpreter() - - @tailrec - def checkState(state: ValidationState, - miner: ErgoLikeTestProvingInterpreter, - currentLevel: Int, - limit: Int): Unit = currentLevel match { - case i if i >= limit => () - case _ => - val block = generateBlock(state, miner, currentLevel) - val updStateTry = state.applyBlock(block) - updStateTry.isSuccess shouldBe true - checkState(updStateTry.get, miner, currentLevel + 1, limit) - } - - val randomDeepness = Gen.chooseNum(10, 20).sample.getOrElse(15) - checkState(state, miner, 0, randomDeepness) - } - - ignore(s"benchmarking applying many blocks (!!! ignored)") { - val results = new TrieMap[Int, Long] - - def bench(numberOfBlocks: Int): Unit = { - - val state = initialState(activatedVersionInTests, initBlock(ergoTreeVersionInTests)) - val miner = new ErgoLikeTestProvingInterpreter() - - val (_, time) = (0 until numberOfBlocks).foldLeft(state -> 0L) { case ((s, timeAcc), h) => - val b = generateBlock(state, miner, h) - - val t0 = System.currentTimeMillis() - val updStateTry = s.applyBlock(b) - val t = System.currentTimeMillis() - - updStateTry.isSuccess shouldBe true - updStateTry.get -> (timeAcc + (t - t0)) - } - - println(s"Total time for $numberOfBlocks blocks: $time ms") - results.put(numberOfBlocks, time) - } - - bench(100) - bench(200) - bench(300) - bench(400) - - printResults(results.toMap) - - def printResults(results: Map[Int, Long]): Unit = { - val file = new File("target/bench") - file.mkdirs() - val writer = new FileWriter(s"target/bench/result.csv", false) - val sorted = results.toList.sortBy { case (i, _) => i } - val header = sorted.map(_._1).mkString(",") - writer.write(s"$header\n") - val values = sorted.map(_._2).mkString(",") - writer.write(s"$values\n") - writer.flush() - writer.close() - } - } -} - -object BlockchainSimulationSpecification { - private lazy val hash = Blake2b256 - - val heightReg = ErgoBox.nonMandatoryRegisters.head - - val windowSize = 10 - - val MaxBlockCost = 1000000 - - case class Block(txs: IndexedSeq[ErgoLikeTransaction], minerPubkey: Array[Byte]) - - class InMemoryErgoBoxReader(prover: ValidationState.BatchProver) extends ErgoBoxReader { - private type KeyType = mutable.WrappedArray.ofByte - - private def getKey(id: Array[Byte]): KeyType = new mutable.WrappedArray.ofByte(id) - - private val boxes = mutable.Map[KeyType, ErgoBox]() - - override def byId(boxId: ADKey): Try[ErgoBox] = byId(getKey(boxId)) - - def byId(boxId: KeyType): Try[ErgoBox] = Try(boxes(boxId)) - - def byHeightRegValue(i: Int): Iterable[ErgoBox] = - boxes.values.filter(_.get(heightReg).getOrElse(IntConstant(i + 1)) == IntConstant(i)) - - def byTwoInts(r1Id: ErgoBox.RegisterId, int1: Int, - r2Id: ErgoBox.RegisterId, int2: Int): Option[ErgoBox] = - boxes.values.find { box => - box.get(r1Id).getOrElse(LongConstant(int1 + 1)) == LongConstant(int1) && - box.get(r2Id).getOrElse(LongConstant(int2 + 1)) == LongConstant(int2) - } - - def allIds: Iterable[KeyType] = boxes.keys - - def applyBlock(block: Block): Unit = { - val toRemove = block.txs.flatMap(_.inputs).map(_.boxId) - toRemove.foreach(k => prover.performOneOperation(Remove(k))) - toRemove.foreach(k => boxes.remove(getKey(k))) - - val toAdd = block.txs.flatMap(_.outputs) - toAdd.foreach(b => prover.performOneOperation(Insert(b.id, ADValue @@ b.bytes))) - toAdd.foreach(b => boxes.put(getKey(b.id), b)) - - prover.generateProof() - } - - def digest: ADDigest = prover.digest - } - - - case class ValidationState(state: BlockchainState, boxesReader: InMemoryErgoBoxReader, activatedVersion: Byte)(implicit IR: IRContext) { - val validator = new ErgoTransactionValidator(activatedVersion) - def applyBlock(block: Block, maxCost: Int = MaxBlockCost): Try[ValidationState] = Try { - val height = state.currentHeight + 1 - - val blockCost = block.txs.foldLeft(0L) { case (accCost, tx) => - validator.validate(tx, state.copy(currentHeight = height), - block.minerPubkey, - boxesReader) match { - case Left(throwable) => throw throwable - case Right(cost) => accCost + cost - } - } - - assert(blockCost <= maxCost, s"Block cost $blockCost exceeds limit $maxCost") - - boxesReader.applyBlock(block) - val newState = BlockchainState(height, state.lastBlockUtxoRoot.copy(digest = boxesReader.digest)) - ValidationState(newState, boxesReader, activatedVersion) - } - } - - object ValidationState { - type BatchProver = BatchAVLProver[Digest32, Blake2b256.type] - - def initBlock(scriptVersion: Byte) = Block( - (0 until windowSize).map { i => - val txId = hash.hash(i.toString.getBytes ++ scala.util.Random.nextString(12).getBytes).toModifierId - val boxes = (1 to 30).map(_ => - testBox(10, - ErgoTree.fromProposition( - ErgoTree.headerWithVersion(scriptVersion), - GE(Height, IntConstant(i)).toSigmaProp), - 0, Seq(), Map(heightReg -> IntConstant(i)), txId)) - ergoplatform.ErgoLikeTransaction(IndexedSeq(), boxes) - }, - ErgoLikeContextTesting.dummyPubkey - ) - - def initialState(activatedVersion: Byte, block: Block)(implicit IR: IRContext): ValidationState = { - val keySize = 32 - val prover = new BatchProver(keySize, None) - - val digest = prover.digest - val utxoRoot = AvlTreeData(digest, AvlTreeFlags.AllOperationsAllowed, keySize) - - val bs = BlockchainState(currentHeight = -2, utxoRoot) - - val boxReader = new InMemoryErgoBoxReader(prover) - - ValidationState(bs, boxReader, activatedVersion).applyBlock(block).get - } - } - -} diff --git a/sc/shared/src/test/scala/sigmastate/utxo/blockchain/BlockchainSimulationSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/blockchain/BlockchainSimulationSpecification.scala index ddd5238819..13ec9f2518 100644 --- a/sc/shared/src/test/scala/sigmastate/utxo/blockchain/BlockchainSimulationSpecification.scala +++ b/sc/shared/src/test/scala/sigmastate/utxo/blockchain/BlockchainSimulationSpecification.scala @@ -55,47 +55,4 @@ class BlockchainSimulationSpecification extends BlockchainSimulationTestingCommo checkState(state, miner, 0, randomDeepness, Some(mkTestErgoTree(prop)), contextExtension) } - ignore(s"benchmarking applying many blocks (!!! ignored)") { - val results = new TrieMap[Int, Long] - - def bench(numberOfBlocks: Int): Unit = { - - val state = ValidationState.initialState(activatedVersionInTests, initBlock(ergoTreeVersionInTests)) - val miner = new ContextEnrichingTestProvingInterpreter() - - val (_, time) = (0 until numberOfBlocks).foldLeft(state -> 0L) { case ((s, timeAcc), h) => - val b = generateBlock(state, miner, h) - - val t0 = System.currentTimeMillis() - val updStateTry = s.applyBlock(b) - val t = System.currentTimeMillis() - - updStateTry shouldBe 'success - updStateTry.get -> (timeAcc + (t - t0)) - } - - println(s"Total time for $numberOfBlocks blocks: $time ms") - results.put(numberOfBlocks, time) - } - - bench(100) - bench(200) - bench(300) - bench(400) - - printResults(results.toMap) - - def printResults(results: Map[Int, Long]): Unit = { - val file = new File("target/bench") - file.mkdirs() - val writer = new FileWriter(s"target/bench/result.csv", false) - val sorted = results.toList.sortBy { case (i, _) => i } - val header = sorted.map(_._1).mkString(",") - writer.write(s"$header\n") - val values = sorted.map(_._2).mkString(",") - writer.write(s"$values\n") - writer.flush() - writer.close() - } - } } \ No newline at end of file diff --git a/sc/shared/src/test/scala/sigmastate/utxo/examples/CoopExampleSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/CoopExampleSpecification.scala index 6f1136e31a..05d1c7995b 100644 --- a/sc/shared/src/test/scala/sigmastate/utxo/examples/CoopExampleSpecification.scala +++ b/sc/shared/src/test/scala/sigmastate/utxo/examples/CoopExampleSpecification.scala @@ -36,14 +36,14 @@ class CoopExampleSpecification extends CompilerTestingCommons prover: ContextEnrichingTestProvingInterpreter, verifier: ErgoLikeTestInterpreter): Assertion = { val proofResult = prover.prove(tree, ctx, fakeMessage) - proofResult should be a 'success - verifier.verify(tree, ctx, proofResult.success.value, fakeMessage) should be a 'success + proofResult shouldBe 'success + verifier.verify(tree, ctx, proofResult.success.value, fakeMessage) shouldBe 'success } def failingProofTest(tree: ErgoTree, ctx: ErgoLikeContext, prover: ContextEnrichingTestProvingInterpreter): Assertion = { - prover.prove(tree, ctx, fakeMessage) should be a 'failure + prover.prove(tree, ctx, fakeMessage) shouldBe 'failure } property("commit to the threshold sig") { diff --git a/sc/shared/src/test/scala/special/sigma/SigmaDslTesting.scala b/sc/shared/src/test/scala/special/sigma/SigmaDslTesting.scala index 444adb337d..e7781a289c 100644 --- a/sc/shared/src/test/scala/special/sigma/SigmaDslTesting.scala +++ b/sc/shared/src/test/scala/special/sigma/SigmaDslTesting.scala @@ -22,8 +22,8 @@ import sigmastate.basics.{SigmaProtocol, SigmaProtocolCommonInput, SigmaProtocol import sigmastate.eval.Extensions._ import sigmastate.eval.{CompiletimeIRContext, CostingBox, CostingDataContext, Evaluation, IRContext, SigmaDsl} import sigmastate.helpers.TestingHelpers._ -import sigmastate.helpers.{ErgoLikeTestInterpreter, SigmaPPrint, ErgoLikeContextTesting, CompilerTestingCommons} -import sigmastate.interpreter.Interpreter.{VerificationResult, ScriptEnv} +import sigmastate.helpers.{CompilerTestingCommons, ErgoLikeContextTesting, ErgoLikeTestInterpreter, SigmaPPrint} +import sigmastate.interpreter.Interpreter.{ScriptEnv, VerificationResult} import sigmastate.interpreter._ import sigmastate.lang.Terms.{Apply, ValueOps} import sigmastate.serialization.ValueSerializer @@ -36,6 +36,7 @@ import debox.cfor import org.scalatest.matchers.should.Matchers import org.scalatest.propspec.AnyPropSpec import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks +import scalan.Platform.threadSleepOrNoOp import java.util import scala.collection.mutable @@ -469,7 +470,7 @@ class SigmaDslTesting extends AnyPropSpec val nIters = nTotalIters / (nBenchmarkIters + 1) repeatAndReturnLast(nIters)(block) System.gc() - Thread.sleep(1000) // let GC to its job before running the tests + threadSleepOrNoOp(1000) // let GC to its job before running the tests } /** Derived class ExistingFeature is used to describe features which don't change from From 04d4055cf783b44ec42da42441598ccc2627b1c9 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Thu, 15 Jun 2023 20:59:32 +0200 Subject: [PATCH 08/58] compiler-js: fix some tests for JS --- build.sbt | 7 + .../scala/sigmastate/crypto/Platform.scala | 4 +- .../scala/org/ergoplatform/ErgoAddress.scala | 2 - .../sigmastate/eval/CostingDataContext.scala | 7 +- .../scala/sigmastate/lang/SigmaBuilder.scala | 13 +- .../scala/sigmastate/lang/LangTests.scala | 6 +- .../scala/sigmastate/TypesSpecification.scala | 2 +- .../sigmastate/helpers/SigmaPPrintSpec.scala | 11 +- .../DeserializationResilience.scala | 31 ++++ .../scala/sigmastate/FailingToProveSpec.scala | 8 +- .../DeserializationResilience.scala | 151 ++++++++---------- .../utxo/BasicOpsSpecification.scala | 18 +-- .../utxo/ComplexSigSpecification.scala | 4 +- .../special/sigma/SigmaDslSpecification.scala | 4 +- .../sdk/DataJsonEncoderSpecification.scala | 11 +- 15 files changed, 152 insertions(+), 127 deletions(-) rename sc/{shared => jvm}/src/test/scala/sigmastate/TypesSpecification.scala (96%) rename sc/{shared => jvm}/src/test/scala/sigmastate/helpers/SigmaPPrintSpec.scala (99%) create mode 100644 sc/jvm/src/test/scala/sigmastate/serialization/DeserializationResilience.scala diff --git a/build.sbt b/build.sbt index 125dfbb4cc..600bf2d51e 100644 --- a/build.sbt +++ b/build.sbt @@ -1,5 +1,6 @@ import scala.language.postfixOps import scala.sys.process._ +import org.scalajs.linker.interface.CheckedBehavior organization := "org.scorexfoundation" @@ -345,6 +346,12 @@ lazy val scJS = sc.js scalaJSLinkerConfig ~= { conf => conf.withSourceMap(false) .withModuleKind(ModuleKind.CommonJSModule) + .withSemantics(sem => + // compliance with JVM semantics is required for tests to pass on JS + // we sacrifice some optimizations (and performance) for that + sem.withAsInstanceOfs(CheckedBehavior.Compliant) + .withArrayIndexOutOfBounds(CheckedBehavior.Compliant) + ) }, Compile / npmDependencies ++= Seq( "sigmajs-crypto-facade" -> sigmajsCryptoFacadeVersion diff --git a/interpreter/jvm/src/main/scala/sigmastate/crypto/Platform.scala b/interpreter/jvm/src/main/scala/sigmastate/crypto/Platform.scala index bdca5949ba..dcd5deabde 100644 --- a/interpreter/jvm/src/main/scala/sigmastate/crypto/Platform.scala +++ b/interpreter/jvm/src/main/scala/sigmastate/crypto/Platform.scala @@ -176,7 +176,7 @@ object Platform { def isCorrectType[T <: SType](value: Any, tpe: T): Boolean = value match { case c: Coll[_] => tpe match { case STuple(items) => c.tItem == RType.AnyType && c.length == items.length - case tpeColl: SCollection[_] => true + case _: SCollection[_] => true case _ => sys.error(s"Collection value $c has unexpected type $tpe") } case _: Option[_] => tpe.isOption @@ -187,7 +187,7 @@ object Platform { case _: Int => tpe == SInt case _: Long => tpe == SLong case _: BigInt => tpe == SBigInt - case _: String => tpe == SString + case _: String => tpe == SString // TODO v6.0: remove this case case _: GroupElement => tpe.isGroupElement case _: SigmaProp => tpe.isSigmaProp case _: AvlTree => tpe.isAvlTree diff --git a/interpreter/shared/src/main/scala/org/ergoplatform/ErgoAddress.scala b/interpreter/shared/src/main/scala/org/ergoplatform/ErgoAddress.scala index b847ae7776..6d6371494b 100644 --- a/interpreter/shared/src/main/scala/org/ergoplatform/ErgoAddress.scala +++ b/interpreter/shared/src/main/scala/org/ergoplatform/ErgoAddress.scala @@ -1,7 +1,5 @@ package org.ergoplatform -import java.util - import scorex.utils.Ints import org.ergoplatform.ErgoAddressEncoder.NetworkPrefix import scorex.crypto.hash.{Digest32, Blake2b256} diff --git a/interpreter/shared/src/main/scala/sigmastate/eval/CostingDataContext.scala b/interpreter/shared/src/main/scala/sigmastate/eval/CostingDataContext.scala index 82e7510c00..b0e1d1ad35 100644 --- a/interpreter/shared/src/main/scala/sigmastate/eval/CostingDataContext.scala +++ b/interpreter/shared/src/main/scala/sigmastate/eval/CostingDataContext.scala @@ -25,12 +25,13 @@ import scalan.{Nullable, RType} import scorex.crypto.hash.{Blake2b256, Digest32, Sha256} import sigmastate.Values.ErgoTree.EmptyConstants import sigmastate.basics.DLogProtocol.ProveDlog -import sigmastate.basics.{ProveDHTuple, CryptoConstants} +import sigmastate.basics.{CryptoConstants, ProveDHTuple} import sigmastate.crypto.{CryptoFacade, Ecp} import sigmastate.lang.TransformingSigmaBuilder import sigmastate.serialization.ErgoTreeSerializer.DefaultSerializer import sigmastate.serialization.{GroupElementSerializer, SigmaSerializer} +import scala.annotation.unused import scala.reflect.ClassTag /** Interface implmented by wrappers to provide access to the underlying wrapped value. */ @@ -304,7 +305,7 @@ case class CAnyValue[A](value: A, tVal: RType[Any]) extends AnyValue { } object CAnyValue { - def apply[A](value: A, t: RType[A])(implicit o: Overloaded1): CAnyValue[A] = + def apply[A](value: A)(implicit t: RType[A], @unused o: Overloaded1): CAnyValue[A] = new CAnyValue(value, t.asInstanceOf[RType[Any]]) } @@ -313,7 +314,7 @@ import sigmastate.eval.CostingBox._ /** A default implementation of [[Box]] interface. * @see [[Box]] for detailed descriptions */ -case class CostingBox(val ebox: ErgoBox) extends Box with WrapperOf[ErgoBox] { +case class CostingBox(ebox: ErgoBox) extends Box with WrapperOf[ErgoBox] { val builder = CostingSigmaDslBuilder val value = ebox.value diff --git a/interpreter/shared/src/main/scala/sigmastate/lang/SigmaBuilder.scala b/interpreter/shared/src/main/scala/sigmastate/lang/SigmaBuilder.scala index a38b6f74f1..85b42d38a1 100644 --- a/interpreter/shared/src/main/scala/sigmastate/lang/SigmaBuilder.scala +++ b/interpreter/shared/src/main/scala/sigmastate/lang/SigmaBuilder.scala @@ -1,10 +1,9 @@ package sigmastate.lang import java.math.BigInteger - import org.ergoplatform.ErgoBox import org.ergoplatform.ErgoBox.RegisterId -import sigmastate.SCollection.{SIntArray, SByteArray} +import sigmastate.SCollection.{SByteArray, SIntArray} import sigmastate.Values._ import sigmastate._ import sigmastate.lang.Constraints._ @@ -15,11 +14,10 @@ import sigmastate.utxo._ import scalan.Nullable import sigmastate.SOption.SIntOption import sigmastate.eval._ -import sigmastate.basics.CryptoConstants.EcPointType import special.collection.Coll import sigmastate.lang.Terms.STypeSubst import sigmastate.serialization.OpCodes.OpCode -import special.sigma.{AvlTree, SigmaProp, GroupElement} +import special.sigma.{AnyValue, AvlTree, GroupElement, SigmaProp} import debox.cfor import scala.util.DynamicVariable @@ -246,8 +244,11 @@ abstract class SigmaBuilder { case arr: Array[Long] => Nullable(mkCollectionConstant[SLong.type](arr, SLong)) case arr: Array[BigInteger] => Nullable(mkCollectionConstant[SBigInt.type](arr.map(SigmaDsl.BigInt(_)), SBigInt)) case arr: Array[String] => Nullable(mkCollectionConstant[SString.type](arr, SString)) - case v: Byte => Nullable(mkConstant[SByte.type](v, SByte)) - case v: Short => Nullable(mkConstant[SShort.type](v, SShort)) + case v: AnyValue => + val tpe = Evaluation.rtypeToSType(v.tVal) + Nullable(mkConstant[tpe.type](v.value.asInstanceOf[tpe.WrappedType], tpe)) +// case v: Byte => Nullable(mkConstant[SByte.type](v, SByte)) +// case v: Short => Nullable(mkConstant[SShort.type](v, SShort)) case v: Int => Nullable(mkConstant[SInt.type](v, SInt)) case v: Long => Nullable(mkConstant[SLong.type](v, SLong)) diff --git a/parsers/shared/src/test/scala/sigmastate/lang/LangTests.scala b/parsers/shared/src/test/scala/sigmastate/lang/LangTests.scala index 8cf6b69d28..7277526f01 100644 --- a/parsers/shared/src/test/scala/sigmastate/lang/LangTests.scala +++ b/parsers/shared/src/test/scala/sigmastate/lang/LangTests.scala @@ -51,10 +51,10 @@ trait LangTests extends Matchers with NegativeTesting { protected val dht1: SigmaBoolean = ProveDHTuple(ecp1, ecp2, ecp3, ecp4) val env = Map( - "x" -> 10, "y" -> 11, "c1" -> true, "c2" -> false, + "x" -> CAnyValue(10), "y" -> CAnyValue(11), "c1" -> true, "c2" -> false, "height1" -> 100L, "height2" -> 200L, - "b1" -> 1.toByte, - "b2" -> 2.toByte, + "b1" -> CAnyValue(1.toByte), + "b2" -> CAnyValue(2.toByte), "arr1" -> arr1, "arr2" -> arr2, "col1" -> ConcreteCollection.fromItems(LongConstant(1), LongConstant(2)), diff --git a/sc/shared/src/test/scala/sigmastate/TypesSpecification.scala b/sc/jvm/src/test/scala/sigmastate/TypesSpecification.scala similarity index 96% rename from sc/shared/src/test/scala/sigmastate/TypesSpecification.scala rename to sc/jvm/src/test/scala/sigmastate/TypesSpecification.scala index d492bc8220..90bea47d61 100644 --- a/sc/shared/src/test/scala/sigmastate/TypesSpecification.scala +++ b/sc/jvm/src/test/scala/sigmastate/TypesSpecification.scala @@ -36,7 +36,7 @@ class TypesSpecification extends SigmaTestingData { assertFalse(true, SByte) assertTrue(0.toByte, SByte) - assertFalse(0.toByte, SShort) + assertFalse(0.toByte, SShort) // TODO JS: this and the other similar cases below fail on JS assertTrue(0.toShort, SShort) assertFalse(0.toShort, SInt) diff --git a/sc/shared/src/test/scala/sigmastate/helpers/SigmaPPrintSpec.scala b/sc/jvm/src/test/scala/sigmastate/helpers/SigmaPPrintSpec.scala similarity index 99% rename from sc/shared/src/test/scala/sigmastate/helpers/SigmaPPrintSpec.scala rename to sc/jvm/src/test/scala/sigmastate/helpers/SigmaPPrintSpec.scala index f732fb7cf2..b990c1d751 100644 --- a/sc/shared/src/test/scala/sigmastate/helpers/SigmaPPrintSpec.scala +++ b/sc/jvm/src/test/scala/sigmastate/helpers/SigmaPPrintSpec.scala @@ -1,23 +1,22 @@ package sigmastate.helpers -import java.math.BigInteger - import org.ergoplatform.settings.ErgoAlgos -import org.ergoplatform.{Outputs, ErgoBox} +import org.ergoplatform.{ErgoBox, Outputs} import scalan.RType import scorex.crypto.authds.ADDigest import scorex.util.ModifierId import sigmastate.Values._ -import sigmastate.lang.Terms.MethodCall -import sigmastate.serialization.OpCodes -import sigmastate.utxo.SelectField import sigmastate._ import sigmastate.eval.Extensions.ArrayOps import sigmastate.eval._ +import sigmastate.lang.Terms.MethodCall +import sigmastate.serialization.OpCodes import sigmastate.utils.Helpers +import sigmastate.utxo.SelectField import special.collection.CollType import special.sigma.SigmaDslTesting +import java.math.BigInteger import scala.collection.mutable.ArrayBuffer class SigmaPPrintSpec extends SigmaDslTesting { diff --git a/sc/jvm/src/test/scala/sigmastate/serialization/DeserializationResilience.scala b/sc/jvm/src/test/scala/sigmastate/serialization/DeserializationResilience.scala new file mode 100644 index 0000000000..0704d31724 --- /dev/null +++ b/sc/jvm/src/test/scala/sigmastate/serialization/DeserializationResilience.scala @@ -0,0 +1,31 @@ +package sigmastate.serialization + +import sigmastate.Values.IntConstant +import sigmastate._ + +class DeserializationResilienceJvm extends DeserializationResilienceTesting { + + implicit lazy val IR: TestingIRContext = new TestingIRContext { + // substFromCostTable = false + saveGraphsInFile = false + // override val okPrintEvaluatedEntries = true + } + + property("reader.level correspondence to the serializer recursive call depth") { + forAll(logicalExprTreeNodeGen(Seq(AND.apply, OR.apply))) { expr => + val (callDepths, levels) = traceReaderCallDepth(expr) + callDepths shouldEqual levels + } + forAll(numExprTreeNodeGen) { numExpr => + val expr = EQ(numExpr, IntConstant(1)) + val (callDepths, levels) = traceReaderCallDepth(expr) + callDepths shouldEqual levels + } + forAll(sigmaBooleanGen) { sigmaBool => + val (callDepths, levels) = traceReaderCallDepth(sigmaBool) + callDepths shouldEqual levels + } + } + + +} diff --git a/sc/shared/src/test/scala/sigmastate/FailingToProveSpec.scala b/sc/shared/src/test/scala/sigmastate/FailingToProveSpec.scala index c48a9cd111..cbff4ca5f8 100644 --- a/sc/shared/src/test/scala/sigmastate/FailingToProveSpec.scala +++ b/sc/shared/src/test/scala/sigmastate/FailingToProveSpec.scala @@ -1,11 +1,13 @@ package sigmastate -import sigmastate.helpers.{ContextEnrichingTestProvingInterpreter, ErgoLikeContextTesting, ErgoLikeTestInterpreter, CompilerTestingCommons} +import sigmastate.helpers.{CompilerTestingCommons, ContextEnrichingTestProvingInterpreter, ErgoLikeContextTesting, ErgoLikeTestInterpreter} import sigmastate.helpers.TestingHelpers._ import sigmastate.lang.Terms._ import org.scalatest.TryValues._ import sigmastate.interpreter.Interpreter.{ScriptNameProp, emptyEnv} +import scala.util.Success + class FailingToProveSpec extends CompilerTestingCommons with CompilerCrossVersionProps { implicit lazy val IR = new TestingIRContext @@ -45,7 +47,7 @@ class FailingToProveSpec extends CompilerTestingCommons minerPubkey = ErgoLikeContextTesting.dummyPubkey, activatedVersion = activatedVersionInTests) val proof = interpreter.prove(emptyEnv + (ScriptNameProp -> "prove"), tree, ctx, fakeMessage).success.value.proof - verifier.verify(emptyEnv + (ScriptNameProp -> "verify"), tree, ctx, proof, fakeMessage) shouldBe 'success + verifier.verify(emptyEnv + (ScriptNameProp -> "verify"), tree, ctx, proof, fakeMessage) shouldBe Success((true, 17L)) } property("successfully evaluate proof 2") { @@ -80,7 +82,7 @@ class FailingToProveSpec extends CompilerTestingCommons minerPubkey = ErgoLikeContextTesting.dummyPubkey, activatedVersion = activatedVersionInTests) val proof = interpreter.prove(emptyEnv + (ScriptNameProp -> "prove"), tree, ctx, fakeMessage).success.value.proof - verifier.verify(emptyEnv + (ScriptNameProp -> "verify"), tree, ctx, proof, fakeMessage) shouldBe 'success + verifier.verify(emptyEnv + (ScriptNameProp -> "verify"), tree, ctx, proof, fakeMessage) shouldBe Success((true, 27L)) } } diff --git a/sc/shared/src/test/scala/sigmastate/serialization/DeserializationResilience.scala b/sc/shared/src/test/scala/sigmastate/serialization/DeserializationResilience.scala index 9bc698127f..39682e92f3 100644 --- a/sc/shared/src/test/scala/sigmastate/serialization/DeserializationResilience.scala +++ b/sc/shared/src/test/scala/sigmastate/serialization/DeserializationResilience.scala @@ -27,8 +27,73 @@ import sigmastate.utils.Helpers._ import scala.collection.mutable import scala.util.{Try, Success, Failure} -class DeserializationResilience extends SerializationSpecification - with CompilerTestingCommons with CompilerCrossVersionProps { +trait DeserializationResilienceTesting extends SerializationSpecification + with CompilerTestingCommons with CompilerCrossVersionProps { + protected def traceReaderCallDepth(expr: SValue): (IndexedSeq[Int], IndexedSeq[Int]) = { + class LoggingSigmaByteReader(r: Reader) extends + SigmaByteReader(r, + new ConstantStore(), + resolvePlaceholdersToConstants = false, + maxTreeDepth = SigmaSerializer.MaxTreeDepth) { + val levels: mutable.ArrayBuilder[Int] = mutable.ArrayBuilder.make[Int] + + override def level_=(v: Int): Unit = { + if (v >= super.level) { + // going deeper (depth is increasing), save new depth to account added depth level by the caller + levels += v + } else { + // going up (depth is decreasing), save previous depth to account added depth level for the caller + levels += super.level + } + super.level_=(v) + } + } + class ProbeException extends Exception + class ThrowingSigmaByteReader( + r: Reader, + levels: IndexedSeq[Int], + throwOnNthLevelCall: Int) extends + SigmaByteReader(r, + new ConstantStore(), + resolvePlaceholdersToConstants = false, + maxTreeDepth = SigmaSerializer.MaxTreeDepth) { + private var levelCall: Int = 0 + + override def level_=(v: Int): Unit = { + if (throwOnNthLevelCall == levelCall) throw new ProbeException() + levelCall += 1 + super.level_=(v) + } + } + val bytes = ValueSerializer.serialize(expr) + val loggingR = new LoggingSigmaByteReader(new VLQByteBufferReader(ByteBuffer.wrap(bytes))).mark() + val _ = ValueSerializer.deserialize(loggingR) + val levels = loggingR.levels.result() + levels.nonEmpty shouldBe true + val callDepthsBuilder = mutable.ArrayBuilder.make[Int] + levels.zipWithIndex.foreach { case (_, levelIndex) => + val throwingR = new ThrowingSigmaByteReader(new VLQByteBufferReader(ByteBuffer.wrap(bytes)), + levels, + throwOnNthLevelCall = levelIndex).mark() + try { + val _ = ValueSerializer.deserialize(throwingR) + } catch { + case e: Exception => + e.isInstanceOf[ProbeException] shouldBe true + val stackTrace = e.getStackTrace + val depth = stackTrace.count { se => + (se.getClassName == ValueSerializer.getClass.getName && se.getMethodName == "deserialize") || + (se.getClassName == DataSerializer.getClass.getName && se.getMethodName == "deserialize") || + (se.getClassName == SigmaBoolean.serializer.getClass.getName && se.getMethodName == "parse") + } + callDepthsBuilder += depth + } + } + (levels, callDepthsBuilder.result()) + } +} + +class DeserializationResilience extends DeserializationResilienceTesting { implicit lazy val IR: TestingIRContext = new TestingIRContext { // substFromCostTable = false @@ -131,84 +196,6 @@ class DeserializationResilience extends SerializationSpecification ValueSerializer.deserialize(Array.fill[Byte](1)(117.toByte)) } - private def traceReaderCallDepth(expr: SValue): (IndexedSeq[Int], IndexedSeq[Int]) = { - class LoggingSigmaByteReader(r: Reader) extends - SigmaByteReader(r, - new ConstantStore(), - resolvePlaceholdersToConstants = false, - maxTreeDepth = SigmaSerializer.MaxTreeDepth) { - val levels: mutable.ArrayBuilder[Int] = mutable.ArrayBuilder.make[Int] - override def level_=(v: Int): Unit = { - if (v >= super.level) { - // going deeper (depth is increasing), save new depth to account added depth level by the caller - levels += v - } else { - // going up (depth is decreasing), save previous depth to account added depth level for the caller - levels += super.level - } - super.level_=(v) - } - } - - class ProbeException extends Exception - - class ThrowingSigmaByteReader(r: Reader, levels: IndexedSeq[Int], throwOnNthLevelCall: Int) extends - SigmaByteReader(r, - new ConstantStore(), - resolvePlaceholdersToConstants = false, - maxTreeDepth = SigmaSerializer.MaxTreeDepth) { - private var levelCall: Int = 0 - override def level_=(v: Int): Unit = { - if (throwOnNthLevelCall == levelCall) throw new ProbeException() - levelCall += 1 - super.level_=(v) - } - } - - val bytes = ValueSerializer.serialize(expr) - val loggingR = new LoggingSigmaByteReader(new VLQByteBufferReader(ByteBuffer.wrap(bytes))).mark() - val _ = ValueSerializer.deserialize(loggingR) - val levels = loggingR.levels.result() - levels.nonEmpty shouldBe true - - val callDepthsBuilder = mutable.ArrayBuilder.make[Int] - levels.zipWithIndex.foreach { case (_, levelIndex) => - val throwingR = new ThrowingSigmaByteReader(new VLQByteBufferReader(ByteBuffer.wrap(bytes)), - levels, - throwOnNthLevelCall = levelIndex).mark() - try { - val _ = ValueSerializer.deserialize(throwingR) - } catch { - case e: Exception => - e.isInstanceOf[ProbeException] shouldBe true - val stackTrace = e.getStackTrace - val depth = stackTrace.count { se => - (se.getClassName == ValueSerializer.getClass.getName && se.getMethodName == "deserialize") || - (se.getClassName == DataSerializer.getClass.getName && se.getMethodName == "deserialize") || - (se.getClassName == SigmaBoolean.serializer.getClass.getName && se.getMethodName == "parse") - } - callDepthsBuilder += depth - } - } - (levels, callDepthsBuilder.result()) - } - - property("reader.level correspondence to the serializer recursive call depth") { - forAll(logicalExprTreeNodeGen(Seq(AND.apply, OR.apply))) { expr => - val (callDepths, levels) = traceReaderCallDepth(expr) - callDepths shouldEqual levels - } - forAll(numExprTreeNodeGen) { numExpr => - val expr = EQ(numExpr, IntConstant(1)) - val (callDepths, levels) = traceReaderCallDepth(expr) - callDepths shouldEqual levels - } - forAll(sigmaBooleanGen) { sigmaBool => - val (callDepths, levels) = traceReaderCallDepth(sigmaBool) - callDepths shouldEqual levels - } - } - property("reader.level is updated in ValueSerializer.deserialize") { val expr = SizeOf(Outputs) val (callDepths, levels) = traceReaderCallDepth(expr) @@ -380,7 +367,7 @@ class DeserializationResilience extends SerializationSpecification property("test assumptions of how negative value from getUInt().toInt is handled") { assertExceptionThrown( safeNewArray[Int](-1), - exceptionLike[NegativeArraySizeException]()) + exceptionLike[RuntimeException]()) // NegativeArraySizeException for JVM and JavaScriptException for Scala.js val bytes = writeUInt(10) val store = new ConstantStore(IndexedSeq(IntConstant(1))) @@ -392,7 +379,7 @@ class DeserializationResilience extends SerializationSpecification assertExceptionThrown( r.getBytes(-1), - exceptionLike[NegativeArraySizeException]()) + exceptionLike[RuntimeException]()) // NegativeArraySizeException for JVM and JavaScriptException for Scala.js r.valDefTypeStore(-1) = SInt // no exception on negative key diff --git a/sc/shared/src/test/scala/sigmastate/utxo/BasicOpsSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/BasicOpsSpecification.scala index 54f1358590..2b5e906a43 100644 --- a/sc/shared/src/test/scala/sigmastate/utxo/BasicOpsSpecification.scala +++ b/sc/shared/src/test/scala/sigmastate/utxo/BasicOpsSpecification.scala @@ -8,13 +8,13 @@ import sigmastate.SCollection.SByteArray import sigmastate.Values._ import sigmastate._ import sigmastate.eval.Extensions._ -import sigmastate.helpers.{ContextEnrichingTestProvingInterpreter, ErgoLikeContextTesting, ErgoLikeTestInterpreter, CompilerTestingCommons} +import sigmastate.helpers.{CompilerTestingCommons, ContextEnrichingTestProvingInterpreter, ErgoLikeContextTesting, ErgoLikeTestInterpreter} import sigmastate.helpers.TestingHelpers._ import sigmastate.interpreter.Interpreter._ import sigmastate.lang.Terms._ import SType.AnyOps import sigmastate.basics.CryptoConstants -import sigmastate.eval.InvalidType +import sigmastate.eval.{CAnyValue, InvalidType} import sigmastate.interpreter.ContextExtension.VarBinding import sigmastate.interpreter.ErgoTreeEvaluator.DefaultEvalSettings import sigmastate.interpreter.EvalSettings @@ -48,12 +48,12 @@ class BasicOpsSpecification extends CompilerTestingCommons (bigIntVar1, BigIntConstant(BigInt(10).underlying())), (bigIntVar2, BigIntConstant(BigInt(20).underlying())), (booleanVar, TrueLeaf)) val env = Map( - "intVar1" -> intVar1, "intVar2" -> intVar2, - "byteVar1" -> byteVar1, "byteVar2" -> byteVar2, "byteVar3" -> byteVar3, - "bigIntVar1" -> bigIntVar1, "bigIntVar2" -> bigIntVar2, "bigIntVar3" -> bigIntVar3, - "trueVar" -> booleanVar, - "proofVar1" -> propVar1, - "proofVar2" -> propVar2 + "intVar1" -> CAnyValue(intVar1), "intVar2" -> CAnyValue(intVar2), + "byteVar1" -> CAnyValue(byteVar1), "byteVar2" -> CAnyValue(byteVar2), "byteVar3" -> CAnyValue(byteVar3), + "bigIntVar1" -> CAnyValue(bigIntVar1), "bigIntVar2" -> CAnyValue(bigIntVar2), "bigIntVar3" -> CAnyValue(bigIntVar3), + "trueVar" -> CAnyValue(booleanVar), + "proofVar1" -> CAnyValue(propVar1), + "proofVar2" -> CAnyValue(propVar2) ) def test(name: String, env: ScriptEnv, @@ -339,7 +339,7 @@ class BasicOpsSpecification extends CompilerTestingCommons val Colls = IR.sigmaDslBuilderValue.Colls implicit val eAny = RType.AnyType val data = Colls.fromItems((Array[Byte](1,2,3).toColl, 10L)) - val env1 = env + ("dataVar" -> dataVar) + val env1 = env + ("dataVar" -> CAnyValue(dataVar)) val dataType = SCollection(STuple(SByteArray, SLong)) val ext1 = ext :+ ((dataVar, Constant[SType](data.asWrappedType, dataType))) test("TupColl3", env1, ext1, diff --git a/sc/shared/src/test/scala/sigmastate/utxo/ComplexSigSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/ComplexSigSpecification.scala index e78f5156a2..89e734a6e8 100644 --- a/sc/shared/src/test/scala/sigmastate/utxo/ComplexSigSpecification.scala +++ b/sc/shared/src/test/scala/sigmastate/utxo/ComplexSigSpecification.scala @@ -4,8 +4,8 @@ import org.ergoplatform.Height import org.scalacheck.Gen import sigmastate.Values.IntConstant import sigmastate._ +import sigmastate.helpers._ import sigmastate.lang.Terms._ -import sigmastate.helpers.{ContextEnrichingTestProvingInterpreter, ErgoLikeContextTesting, ErgoLikeTestInterpreter, ErgoLikeTransactionTesting, CompilerTestingCommons} import scala.util.Random @@ -625,7 +625,7 @@ class ComplexSigSpecification extends CompilerTestingCommons val proverWithKSecrets = prover.withSecrets( shuffledProvers.takeRight(neededExtraSecrets).map(_.dlogSecrets.head)) val prTry = proverWithKSecrets.prove(propTree, ctx, fakeMessage) - prTry shouldBe 'success + prTry.isSuccess shouldBe true verifier.verify(propTree, ctx, prTry.get, fakeMessage).get._1 shouldBe true } } diff --git a/sc/shared/src/test/scala/special/sigma/SigmaDslSpecification.scala b/sc/shared/src/test/scala/special/sigma/SigmaDslSpecification.scala index 11f129600e..18f5a980c5 100644 --- a/sc/shared/src/test/scala/special/sigma/SigmaDslSpecification.scala +++ b/sc/shared/src/test/scala/special/sigma/SigmaDslSpecification.scala @@ -4778,8 +4778,8 @@ class SigmaDslSpecification extends SigmaDslTesting vars = Colls .replicate[AnyValue](10, null) // reserve 10 vars .append(Coll[AnyValue]( - CAnyValue(Helpers.decodeBytes("00"), CollType(RType.ByteType)), - CAnyValue(true, RType.BooleanType))), + CAnyValue(Helpers.decodeBytes("00")), + CAnyValue(true))), activatedScriptVersion = activatedVersionInTests, currentErgoTreeVersion = ergoTreeVersionInTests ) diff --git a/sdk/shared/src/test/scala/org/ergoplatform/sdk/DataJsonEncoderSpecification.scala b/sdk/shared/src/test/scala/org/ergoplatform/sdk/DataJsonEncoderSpecification.scala index 3627f99582..cdcd0906c0 100644 --- a/sdk/shared/src/test/scala/org/ergoplatform/sdk/DataJsonEncoderSpecification.scala +++ b/sdk/shared/src/test/scala/org/ergoplatform/sdk/DataJsonEncoderSpecification.scala @@ -29,7 +29,6 @@ class DataJsonEncoderSpecification extends SerializationSpecification { implicit val wWrapped = wrappedTypeGen(tpe) implicit val tT = Evaluation.stypeToRType(tpe) implicit val tagT = tT.classTag - implicit val tAny = RType.AnyType forAll { xs: Array[T#WrappedType] => roundtrip[SCollection[T]](xs.toColl, SCollection(tpe)) roundtrip[SType](xs.toColl.map(x => (x, x)).asWrappedType, SCollection(STuple(tpe, tpe))) @@ -65,19 +64,19 @@ class DataJsonEncoderSpecification extends SerializationSpecification { implicit val tT = Evaluation.stypeToRType(tpe) implicit val tAny = RType.AnyType forAll { in: T#WrappedType => - val x = CAnyValue(in, tT) + val x = CAnyValue(in) val json = JsonCodecs.anyValueEncoder(x) val y = JsonCodecs.anyValueDecoder.decodeJson(json).right.get x shouldBe y - val tTup = Evaluation.stypeToRType(STuple(tpe, tpe)).asInstanceOf[RType[(T#WrappedType, T#WrappedType)]] - val xTup = CAnyValue((in, in), tTup) + implicit val tTup = Evaluation.stypeToRType(STuple(tpe, tpe)).asInstanceOf[RType[(T#WrappedType, T#WrappedType)]] + val xTup = CAnyValue((in, in)) val jsonTup = JsonCodecs.anyValueEncoder(xTup) val yTup = JsonCodecs.anyValueDecoder.decodeJson(jsonTup).right.get xTup shouldBe yTup - val tColl = Evaluation.stypeToRType(SCollection(tpe)) - val xColl = CAnyValue(SigmaDsl.Colls.fromItems(in, in), tColl) + implicit val tColl = Evaluation.stypeToRType(SCollection(tpe)) + val xColl = CAnyValue(SigmaDsl.Colls.fromItems(in, in)) val jsonColl = JsonCodecs.anyValueEncoder(xColl) val yColl = JsonCodecs.anyValueDecoder.decodeJson(jsonColl).right.get xColl shouldBe yColl From 2ca44cd05d3fcfdde90950b2548de05301684994 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Thu, 15 Jun 2023 21:56:30 +0200 Subject: [PATCH 09/58] compiler-js: fix JVM tests --- .../src/main/scala/sigmastate/lang/SigmaBuilder.scala | 2 +- .../src/test/scala/sigmastate/eval/ExampleContracts.scala | 4 ++-- .../scala/sigmastate/utxo/SigmaCompilerSpecification.scala | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/interpreter/shared/src/main/scala/sigmastate/lang/SigmaBuilder.scala b/interpreter/shared/src/main/scala/sigmastate/lang/SigmaBuilder.scala index 85b42d38a1..6d7c3552d4 100644 --- a/interpreter/shared/src/main/scala/sigmastate/lang/SigmaBuilder.scala +++ b/interpreter/shared/src/main/scala/sigmastate/lang/SigmaBuilder.scala @@ -290,7 +290,7 @@ abstract class SigmaBuilder { Nullable(mkCollectionConstant(coll.asInstanceOf[SCollection[SType]#WrappedType], tpeItem)) case _ => - Nullable.None + sys.error(s"Cannot liftToConstant($obj)") } } diff --git a/sc/shared/src/test/scala/sigmastate/eval/ExampleContracts.scala b/sc/shared/src/test/scala/sigmastate/eval/ExampleContracts.scala index 8e836f04d0..913a82167f 100644 --- a/sc/shared/src/test/scala/sigmastate/eval/ExampleContracts.scala +++ b/sc/shared/src/test/scala/sigmastate/eval/ExampleContracts.scala @@ -7,8 +7,8 @@ trait ExampleContracts extends ErgoScriptTestkit { self: BaseCtxTests => val envCF = Map( "timeout" -> timeout, "minToRaise" -> minToRaise, - "backerPubKeyId" -> backerPubKeyId, - "projectPubKeyId" -> projectPubKeyId + "backerPubKeyId" -> CAnyValue(backerPubKeyId), + "projectPubKeyId" -> CAnyValue(projectPubKeyId) ) val crowdFundingScript = diff --git a/sc/shared/src/test/scala/sigmastate/utxo/SigmaCompilerSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/SigmaCompilerSpecification.scala index 280683cfcc..ffbb02dd98 100644 --- a/sc/shared/src/test/scala/sigmastate/utxo/SigmaCompilerSpecification.scala +++ b/sc/shared/src/test/scala/sigmastate/utxo/SigmaCompilerSpecification.scala @@ -1,11 +1,11 @@ package sigmastate.utxo -import sigmastate.{GE, ModQ, SType} import sigmastate.Values._ +import sigmastate.eval.CAnyValue import sigmastate.helpers.CompilerTestingCommons import sigmastate.interpreter.Interpreter.ScriptEnv import sigmastate.lang.Terms._ -import sigmastate._ +import sigmastate.{GE, ModQ, SType} /** * Specification for compile function @@ -17,7 +17,7 @@ class SigmaCompilerSpecification extends CompilerTestingCommons { property(">= compile") { val elementId = 1: Byte - val env = Map("elementId" -> elementId) + val env = Map("elementId" -> CAnyValue(elementId)) val propTree = GE(GetVarInt(elementId).get, IntConstant(120)) val propComp = compile(env, """{ From 7ffdd794521c55db2b80dd118dc5be60e14b0560 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Fri, 16 Jun 2023 13:19:21 +0200 Subject: [PATCH 10/58] compiler-js: fix most test under JS (except crypto) --- .../shared/src/main/scala/scalan/Base.scala | 9 +++++ .../scala/sigmastate/eval/GraphBuilding.scala | 3 +- .../scala/sigmastate/eval/TreeBuilding.scala | 2 +- .../scala/sigmastate/lang/SigmaTyper.scala | 3 -- .../org/ergoplatform/ErgoTreePredefSpec.scala | 34 +++++++++---------- .../examples/CoopExampleSpecification.scala | 6 ++-- 6 files changed, 32 insertions(+), 25 deletions(-) diff --git a/graph-ir/shared/src/main/scala/scalan/Base.scala b/graph-ir/shared/src/main/scala/scalan/Base.scala index 3674e32372..b105665f14 100644 --- a/graph-ir/shared/src/main/scala/scalan/Base.scala +++ b/graph-ir/shared/src/main/scala/scalan/Base.scala @@ -403,6 +403,15 @@ abstract class Base { scalan: Scalan => * @param eT type descriptor of IR type T */ case class Const[T](x: T)(implicit val eT: Elem[T]) extends BaseDef[T] { override def mirror(t: Transformer): Ref[T] = self + + // NOTE, we need to override hashCode and equals to involve eT. + // This is necessary for JS as there is no distinction between Byte, Short, Int values + // and comparing x == other.x is not enough. + override def hashCode() = x.hashCode() * 31 + eT.hashCode() + override def equals(other: Any) = (this eq other.asInstanceOf[AnyRef]) || (other match { + case c: Const[_] => x == c.x && eT == c.eT + case _ => false + }) } /** Node class for typed variables. In particular for lambda-bound variables. diff --git a/sc/shared/src/main/scala/sigmastate/eval/GraphBuilding.scala b/sc/shared/src/main/scala/sigmastate/eval/GraphBuilding.scala index cae5eb7110..085ad468f9 100644 --- a/sc/shared/src/main/scala/sigmastate/eval/GraphBuilding.scala +++ b/sc/shared/src/main/scala/sigmastate/eval/GraphBuilding.scala @@ -479,7 +479,8 @@ trait GraphBuilding extends SigmaLibrary { IR: IRContext => val resV = toRep(s)(stypeToElem(tpe).asInstanceOf[Elem[String]]) resV case _ => - val resV = toRep(v)(stypeToElem(tpe)) + val e = stypeToElem(tpe) + val resV = toRep(v)(e) resV } case org.ergoplatform.Context => ctx diff --git a/sc/shared/src/main/scala/sigmastate/eval/TreeBuilding.scala b/sc/shared/src/main/scala/sigmastate/eval/TreeBuilding.scala index 444cd3bb9e..f6e77f12e0 100644 --- a/sc/shared/src/main/scala/sigmastate/eval/TreeBuilding.scala +++ b/sc/shared/src/main/scala/sigmastate/eval/TreeBuilding.scala @@ -217,7 +217,7 @@ trait TreeBuilding extends SigmaLibrary { IR: IRContext => case SDBM.xor(_, colSym1, colSym2) => mkXor(recurse(colSym1), recurse(colSym2)) - case ContextM.getVar(_, Def(Const(id: Byte)), eVar) => + case ContextM.getVar(_, Def(Const(id)), eVar) => val tpe = elemToSType(eVar) mkGetVar(id, tpe) diff --git a/sc/shared/src/main/scala/sigmastate/lang/SigmaTyper.scala b/sc/shared/src/main/scala/sigmastate/lang/SigmaTyper.scala index b8d23051dd..ad4dddcf51 100644 --- a/sc/shared/src/main/scala/sigmastate/lang/SigmaTyper.scala +++ b/sc/shared/src/main/scala/sigmastate/lang/SigmaTyper.scala @@ -508,9 +508,6 @@ class SigmaTyper(val builder: SigmaBuilder, case Inputs => Inputs case Outputs => Outputs case LastBlockUtxoRootHash => LastBlockUtxoRootHash - case c @ LongConstant(i) if expected.isDefined && expected.get == SByte => - if (i >= 0 && i <= Byte.MaxValue) ByteConstant(i.toByte) - else error(s"Value $i of type Long cannot be converted to Byte.", c.sourceContext) case v: ContextVariable[_] => v case v: GetVar[_] => v case v: OptionGet[_] => v diff --git a/sc/shared/src/test/scala/org/ergoplatform/ErgoTreePredefSpec.scala b/sc/shared/src/test/scala/org/ergoplatform/ErgoTreePredefSpec.scala index 86e7ab6b7f..36c5e78067 100644 --- a/sc/shared/src/test/scala/org/ergoplatform/ErgoTreePredefSpec.scala +++ b/sc/shared/src/test/scala/org/ergoplatform/ErgoTreePredefSpec.scala @@ -87,15 +87,15 @@ class ErgoTreePredefSpec extends CompilerTestingCommons with CompilerCrossVersio def checkAtHeight(height: Int) = { // collect correct amount of coins, correct new script, able to satisfy R4 conditions - checkSpending(remaining(height), height, prop, R4Prop(true)) shouldBe 'success + checkSpending(remaining(height), height, prop, R4Prop(true)).isSuccess shouldBe true // unable to satisfy R4 conditions - checkSpending(remaining(height), height, prop, R4Prop(false)) shouldBe 'failure + checkSpending(remaining(height), height, prop, R4Prop(false)).isFailure shouldBe true // incorrect new script - checkSpending(remaining(height), height, TrivialProp.TrueProp, R4Prop(true)) shouldBe 'failure + checkSpending(remaining(height), height, TrivialProp.TrueProp, R4Prop(true)).isFailure shouldBe true // collect less coins then possible - checkSpending(remaining(height) + 1, height, prop, R4Prop(true)) shouldBe 'success + checkSpending(remaining(height) + 1, height, prop, R4Prop(true)).isSuccess shouldBe true // collect more coins then possible - checkSpending(remaining(height) - 1, height, prop, R4Prop(true)) shouldBe 'failure + checkSpending(remaining(height) - 1, height, prop, R4Prop(true)).isFailure shouldBe true } def checkSpending(remainingAmount: Long, @@ -165,16 +165,16 @@ class ErgoTreePredefSpec extends CompilerTestingCommons with CompilerCrossVersio forAll(Gen.choose(1, settings.fixedRatePeriod)) { height => val currentRate = emission.minersRewardAtHeight(height) createRewardTx(currentRate, height, minerProp).getOrThrow - createRewardTx(currentRate + 1, height, minerProp) shouldBe 'failure - createRewardTx(currentRate - 1, height, minerProp) shouldBe 'failure + createRewardTx(currentRate + 1, height, minerProp).isFailure shouldBe true + createRewardTx(currentRate - 1, height, minerProp).isFailure shouldBe true } // collect coins after the fixed rate period forAll(Gen.choose(1, emission.blocksTotal - 1)) { height => val currentRate = emission.minersRewardAtHeight(height) - createRewardTx(currentRate, height, minerProp) shouldBe 'success - createRewardTx(currentRate + 1, height, minerProp) shouldBe 'failure - createRewardTx(currentRate - 1, height, minerProp) shouldBe 'failure + createRewardTx(currentRate, height, minerProp).isSuccess shouldBe true + createRewardTx(currentRate + 1, height, minerProp).isFailure shouldBe true + createRewardTx(currentRate - 1, height, minerProp).isFailure shouldBe true } // collect coins to incorrect proposition @@ -184,10 +184,10 @@ class ErgoTreePredefSpec extends CompilerTestingCommons with CompilerCrossVersio val correctProp = ErgoTreePredef.rewardOutputScript(settings.minerRewardDelay, minerPk) val incorrectDelay = ErgoTreePredef.rewardOutputScript(settings.minerRewardDelay + 1, minerPk) val incorrectPk = ErgoTreePredef.rewardOutputScript(settings.minerRewardDelay, pk2) - createRewardTx(currentRate, height, correctProp) shouldBe 'success - createRewardTx(currentRate, height, incorrectDelay) shouldBe 'failure - createRewardTx(currentRate, height, incorrectPk) shouldBe 'failure - createRewardTx(currentRate, height, minerPk) shouldBe 'failure + createRewardTx(currentRate, height, correctProp).isSuccess shouldBe true + createRewardTx(currentRate, height, incorrectDelay).isFailure shouldBe true + createRewardTx(currentRate, height, incorrectPk).isFailure shouldBe true + createRewardTx(currentRate, height, minerPk).isFailure shouldBe true } def createRewardTx(emissionAmount: Long, nextHeight: Int, minerProp: ErgoTree): Try[ErgoLikeTransaction] = { @@ -244,7 +244,7 @@ class ErgoTreePredefSpec extends CompilerTestingCommons with CompilerCrossVersio val inputs1 = IndexedSeq( testBox(20, prop, 0, Seq((wrongId, tokenAmount), (tokenId, tokenAmount - 1)), Map()) ) - check(inputs1) shouldBe 'failure + check(inputs1).isFailure shouldBe true // transaction with multiple inputs with insufficient token should fail val inputs2 = IndexedSeq( @@ -252,7 +252,7 @@ class ErgoTreePredefSpec extends CompilerTestingCommons with CompilerCrossVersio testBox(20, prop, 0, Seq((wrongId, tokenAmount)), Map()), testBox(20, prop, 0, Seq((tokenId, 1), (wrongId2, tokenAmount)), Map()) ) - check(inputs2) shouldBe 'failure + check(inputs2).isFailure shouldBe true // transaction with multiple inputs with enough token should pass val inputs3 = IndexedSeq( @@ -268,7 +268,7 @@ class ErgoTreePredefSpec extends CompilerTestingCommons with CompilerCrossVersio testBox(20, prop, 0, Seq(), Map()), testBox(20, prop, 0, Seq((tokenId, tokenAmount / 2 + 1), (wrongId2, 1)), Map()) ) - check(inputs4) shouldBe 'success + check(inputs4).isSuccess shouldBe true } /* Iter 0: 777 ms diff --git a/sc/shared/src/test/scala/sigmastate/utxo/examples/CoopExampleSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/CoopExampleSpecification.scala index 05d1c7995b..3a2bf8b0c3 100644 --- a/sc/shared/src/test/scala/sigmastate/utxo/examples/CoopExampleSpecification.scala +++ b/sc/shared/src/test/scala/sigmastate/utxo/examples/CoopExampleSpecification.scala @@ -36,14 +36,14 @@ class CoopExampleSpecification extends CompilerTestingCommons prover: ContextEnrichingTestProvingInterpreter, verifier: ErgoLikeTestInterpreter): Assertion = { val proofResult = prover.prove(tree, ctx, fakeMessage) - proofResult shouldBe 'success - verifier.verify(tree, ctx, proofResult.success.value, fakeMessage) shouldBe 'success + proofResult.isSuccess shouldBe true + verifier.verify(tree, ctx, proofResult.success.value, fakeMessage).isSuccess shouldBe true } def failingProofTest(tree: ErgoTree, ctx: ErgoLikeContext, prover: ContextEnrichingTestProvingInterpreter): Assertion = { - prover.prove(tree, ctx, fakeMessage) shouldBe 'failure + prover.prove(tree, ctx, fakeMessage).isFailure shouldBe true } property("commit to the threshold sig") { From eec4e5e7829bcee80306dfd9ba163efca41f35c7 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Fri, 16 Jun 2023 15:07:39 +0200 Subject: [PATCH 11/58] compiler-js: fix sc/test execution + upgrade sbt --- build.sbt | 3 ++- project/build.properties | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 600bf2d51e..4ed92cf2ee 100644 --- a/build.sbt +++ b/build.sbt @@ -6,7 +6,7 @@ organization := "org.scorexfoundation" name := "sigma-state" -lazy val scala213 = "2.13.9" +lazy val scala213 = "2.13.10" lazy val scala212 = "2.12.15" lazy val scala211 = "2.11.12" @@ -327,6 +327,7 @@ lazy val sc = crossProject(JVMPlatform, JSPlatform) commonDependenies2, testingDependencies2, scorexUtilDependency, fastparseDependency, circeDependency, + Test / parallelExecution := false ) .settings(publish / skip := true) .jvmSettings( diff --git a/project/build.properties b/project/build.properties index 9edb75b77c..c8fcab543a 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.5.4 +sbt.version=1.6.2 From 0a023e1bb78734ea69dc520ff380c133f97a2359 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Fri, 16 Jun 2023 22:27:44 +0200 Subject: [PATCH 12/58] compiler-js: introduce Environment --- build.sbt | 3 + .../scala/scalan/reflection/Platform.scala | 5 ++ .../scala/scalan/reflection/Platform.scala | 4 ++ .../main/scala/sigmastate/Environment.scala | 24 +++++++ .../scala/sigmastate/RuntimePlatform.scala | 17 +++++ .../src/main/scala/sigmastate/Platform.scala | 65 +++++++++++++++++++ .../src/main/scala/sigmastate/Platform.scala | 64 ++++++++++++++++++ .../sigmastate/eval/CostingDataContext.scala | 12 ++-- .../scala/sigmastate/eval/Extensions.scala | 44 ++++++++++--- .../scala/sigmastate/lang/SigmaBuilder.scala | 65 ++----------------- .../src/main/scala/sigmastate/trees.scala | 12 ++-- .../main/scala/sigmastate/utils/Helpers.scala | 20 +++++- .../sigmastate/lang/SigmaBuilderTest.scala | 5 ++ 13 files changed, 257 insertions(+), 83 deletions(-) create mode 100644 common/shared/src/main/scala/sigmastate/Environment.scala create mode 100644 common/shared/src/main/scala/sigmastate/RuntimePlatform.scala create mode 100644 interpreter/js/src/main/scala/sigmastate/Platform.scala create mode 100644 interpreter/jvm/src/main/scala/sigmastate/Platform.scala diff --git a/build.sbt b/build.sbt index 4ed92cf2ee..8d68f0de0c 100644 --- a/build.sbt +++ b/build.sbt @@ -97,6 +97,9 @@ val fastparse = "com.lihaoyi" %% "fastparse" % "2.3.3" val fastparseDependency = libraryDependencies += "com.lihaoyi" %%% "fastparse" % "2.3.3" +val supertaggedDependency = + libraryDependencies += "org.rudogma" %%% "supertagged" % "2.0-RC2" + val scalaCompat = "org.scala-lang.modules" %% "scala-collection-compat" % "2.7.0" lazy val scodecBitsDependency = libraryDependencies += "org.scodec" %%% "scodec-bits" % "1.1.34" diff --git a/common/js/src/main/scala/scalan/reflection/Platform.scala b/common/js/src/main/scala/scalan/reflection/Platform.scala index 4e78edef5d..9b8f1694a2 100644 --- a/common/js/src/main/scala/scalan/reflection/Platform.scala +++ b/common/js/src/main/scala/scalan/reflection/Platform.scala @@ -1,5 +1,7 @@ package scalan.reflection +import sigmastate.RuntimePlatform + import scala.collection.mutable /** JS Platform dependent implementation of reflection methods. */ @@ -52,4 +54,7 @@ object Platform { def safeSimpleName(cl: Class[_]): String = { cl.getSimpleName } + + /** Returns current runtime platform descriptor. */ + def runtimePlatform: RuntimePlatform = RuntimePlatform.JS } diff --git a/common/jvm/src/main/scala/scalan/reflection/Platform.scala b/common/jvm/src/main/scala/scalan/reflection/Platform.scala index 7088a4ae1a..7129cfb814 100644 --- a/common/jvm/src/main/scala/scalan/reflection/Platform.scala +++ b/common/jvm/src/main/scala/scalan/reflection/Platform.scala @@ -1,5 +1,6 @@ package scalan.reflection +import sigmastate.RuntimePlatform import scala.collection.concurrent.TrieMap @@ -82,4 +83,7 @@ object Platform { // Eventually, this is the empty string iff this is an anonymous class simpleName.substring(index) } + + /** Returns current runtime platform descriptor. */ + def runtimePlatform: RuntimePlatform = RuntimePlatform.JVM } diff --git a/common/shared/src/main/scala/sigmastate/Environment.scala b/common/shared/src/main/scala/sigmastate/Environment.scala new file mode 100644 index 0000000000..41acbc77f5 --- /dev/null +++ b/common/shared/src/main/scala/sigmastate/Environment.scala @@ -0,0 +1,24 @@ +package sigmastate + +import scalan.reflection.Platform + +/** Describes the current execution environment. */ +sealed abstract class Environment { + /** Runtime platform for the current environment. */ + def runtimePlatform: RuntimePlatform + + /** Returns true when executed on JVM. */ + def isJVM: Boolean + + /** Returns true when executed on JS. */ + def isJS: Boolean +} + +object Environment { + /** Current runtime environment. */ + implicit val current: Environment = new Environment { + override def isJVM: Boolean = runtimePlatform == RuntimePlatform.JVM + override def isJS: Boolean = runtimePlatform == RuntimePlatform.JS + override def runtimePlatform: RuntimePlatform = Platform.runtimePlatform + } +} \ No newline at end of file diff --git a/common/shared/src/main/scala/sigmastate/RuntimePlatform.scala b/common/shared/src/main/scala/sigmastate/RuntimePlatform.scala new file mode 100644 index 0000000000..d45b727465 --- /dev/null +++ b/common/shared/src/main/scala/sigmastate/RuntimePlatform.scala @@ -0,0 +1,17 @@ +package sigmastate + +/** Descriptor of a runtime platform. Can be used to conditionally execute code. */ +sealed trait RuntimePlatform { + /** Platform code (unique for each platform) */ + def code: Int +} + +object RuntimePlatform { + case object JVM extends RuntimePlatform { + val code = 1 + } + + case object JS extends RuntimePlatform { + val code = 2 + } +} \ No newline at end of file diff --git a/interpreter/js/src/main/scala/sigmastate/Platform.scala b/interpreter/js/src/main/scala/sigmastate/Platform.scala new file mode 100644 index 0000000000..8dbdecb3e0 --- /dev/null +++ b/interpreter/js/src/main/scala/sigmastate/Platform.scala @@ -0,0 +1,65 @@ +package sigmastate + +import org.ergoplatform.ErgoBox +import scalan.Nullable +import sigmastate.Values.{Constant, FalseLeaf, SigmaBoolean, TrueLeaf} +import sigmastate.eval.{Evaluation, SigmaDsl} +import sigmastate.lang.SigmaBuilder +import special.collection.Coll +import special.sigma.{AnyValue, AvlTree, GroupElement, SigmaProp} + +import java.math.BigInteger + +object Platform { + /** Creates a new Constant instance with an appropriate type derived from the given data `obj`. + * Uses scalan.Nullable instead of scala.Option to avoid allocation on consensus hot path. + * This method is part of consensus and is used in [[SubstConstants]] operation. + */ + def liftToConstant(obj: Any, builder: SigmaBuilder): Nullable[Constant[SType]] = { + import builder._ + obj match { + case arr: Array[Boolean] => Nullable(mkCollectionConstant[SBoolean.type](arr, SBoolean)) + case arr: Array[Byte] => Nullable(mkCollectionConstant[SByte.type](arr, SByte)) + case arr: Array[Short] => Nullable(mkCollectionConstant[SShort.type](arr, SShort)) + case arr: Array[Int] => Nullable(mkCollectionConstant[SInt.type](arr, SInt)) + case arr: Array[Long] => Nullable(mkCollectionConstant[SLong.type](arr, SLong)) + case arr: Array[BigInteger] => Nullable(mkCollectionConstant[SBigInt.type](arr.map(SigmaDsl.BigInt(_)), SBigInt)) + case arr: Array[String] => Nullable(mkCollectionConstant[SString.type](arr, SString)) + case v: AnyValue => + val tpe = Evaluation.rtypeToSType(v.tVal) + Nullable(mkConstant[tpe.type](v.value.asInstanceOf[tpe.WrappedType], tpe)) + case v: Int => Nullable(mkConstant[SInt.type](v, SInt)) + case v: Long => Nullable(mkConstant[SLong.type](v, SLong)) + case v: BigInteger => Nullable(mkConstant[SBigInt.type](SigmaDsl.BigInt(v), SBigInt)) + case n: special.sigma.BigInt => Nullable(mkConstant[SBigInt.type](n, SBigInt)) + case ge: GroupElement => Nullable(mkConstant[SGroupElement.type](ge, SGroupElement)) + case b: Boolean => Nullable(if (b) TrueLeaf else FalseLeaf) + case v: String => Nullable(mkConstant[SString.type](v, SString)) + + // The Box lifting was broken in v4.x. `SigmaDsl.Box(b)` was missing which means the + // isCorrectType requirement would fail in ConstantNode constructor. + // This method is used as part of consensus in SubstConstants operation, however + // ErgoBox cannot be passed as argument as it is never valid value during evaluation. + // Thus we can use activation-based versioning and fix this code when v5.0 is activated. + case b: ErgoBox => + Nullable(mkConstant[SBox.type](SigmaDsl.Box(b), SBox)) // fixed in v5.0 + + // this case is added in v5.0 and it can be useful when the box value comes from a + // register or a context variable is passed to SubstConstants. + case b: special.sigma.Box => + if (VersionContext.current.isJitActivated) + Nullable(mkConstant[SBox.type](b, SBox)) + else + Nullable.None // return the same result as in v4.x when there was no this case + case avl: AvlTreeData => Nullable(mkConstant[SAvlTree.type](SigmaDsl.avlTree(avl), SAvlTree)) + case avl: AvlTree => Nullable(mkConstant[SAvlTree.type](avl, SAvlTree)) + case sb: SigmaBoolean => Nullable(mkConstant[SSigmaProp.type](SigmaDsl.SigmaProp(sb), SSigmaProp)) + case p: SigmaProp => Nullable(mkConstant[SSigmaProp.type](p, SSigmaProp)) + case coll: Coll[a] => + val tpeItem = Evaluation.rtypeToSType(coll.tItem) + Nullable(mkCollectionConstant(coll.asInstanceOf[SCollection[SType]#WrappedType], tpeItem)) + case _ => + Nullable.None + } + } +} diff --git a/interpreter/jvm/src/main/scala/sigmastate/Platform.scala b/interpreter/jvm/src/main/scala/sigmastate/Platform.scala new file mode 100644 index 0000000000..703940ca45 --- /dev/null +++ b/interpreter/jvm/src/main/scala/sigmastate/Platform.scala @@ -0,0 +1,64 @@ +package sigmastate + +import org.ergoplatform.ErgoBox +import scalan.Nullable +import sigmastate.Values.{Constant, FalseLeaf, SigmaBoolean, TrueLeaf} +import sigmastate.eval.{Evaluation, SigmaDsl} +import sigmastate.lang.SigmaBuilder +import special.collection.Coll +import special.sigma.{AnyValue, AvlTree, GroupElement, SigmaProp} + +import java.math.BigInteger + +object Platform { + /** Creates a new Constant instance with an appropriate type derived from the given data `obj`. + * Uses scalan.Nullable instead of scala.Option to avoid allocation on consensus hot path. + * This method is part of consensus and is used in [[SubstConstants]] operation. + */ + def liftToConstant(obj: Any, builder: SigmaBuilder): Nullable[Constant[SType]] = { + import builder._ + obj match { + case arr: Array[Boolean] => Nullable(mkCollectionConstant[SBoolean.type](arr, SBoolean)) + case arr: Array[Byte] => Nullable(mkCollectionConstant[SByte.type](arr, SByte)) + case arr: Array[Short] => Nullable(mkCollectionConstant[SShort.type](arr, SShort)) + case arr: Array[Int] => Nullable(mkCollectionConstant[SInt.type](arr, SInt)) + case arr: Array[Long] => Nullable(mkCollectionConstant[SLong.type](arr, SLong)) + case arr: Array[BigInteger] => Nullable(mkCollectionConstant[SBigInt.type](arr.map(SigmaDsl.BigInt(_)), SBigInt)) + case arr: Array[String] => Nullable(mkCollectionConstant[SString.type](arr, SString)) + case v: Byte => Nullable(mkConstant[SByte.type](v, SByte)) + case v: Short => Nullable(mkConstant[SShort.type](v, SShort)) + case v: Int => Nullable(mkConstant[SInt.type](v, SInt)) + case v: Long => Nullable(mkConstant[SLong.type](v, SLong)) + case v: BigInteger => Nullable(mkConstant[SBigInt.type](SigmaDsl.BigInt(v), SBigInt)) + case n: special.sigma.BigInt => Nullable(mkConstant[SBigInt.type](n, SBigInt)) + case ge: GroupElement => Nullable(mkConstant[SGroupElement.type](ge, SGroupElement)) + case b: Boolean => Nullable(if (b) TrueLeaf else FalseLeaf) + case v: String => Nullable(mkConstant[SString.type](v, SString)) + + // The Box lifting was broken in v4.x. `SigmaDsl.Box(b)` was missing which means the + // isCorrectType requirement would fail in ConstantNode constructor. + // This method is used as part of consensus in SubstConstants operation, however + // ErgoBox cannot be passed as argument as it is never valid value during evaluation. + // Thus we can use activation-based versioning and fix this code when v5.0 is activated. + case b: ErgoBox => + Nullable(mkConstant[SBox.type](SigmaDsl.Box(b), SBox)) // fixed in v5.0 + + // this case is added in v5.0 and it can be useful when the box value comes from a + // register or a context variable is passed to SubstConstants. + case b: special.sigma.Box => + if (VersionContext.current.isJitActivated) + Nullable(mkConstant[SBox.type](b, SBox)) + else + Nullable.None // return the same result as in v4.x when there was no this case + case avl: AvlTreeData => Nullable(mkConstant[SAvlTree.type](SigmaDsl.avlTree(avl), SAvlTree)) + case avl: AvlTree => Nullable(mkConstant[SAvlTree.type](avl, SAvlTree)) + case sb: SigmaBoolean => Nullable(mkConstant[SSigmaProp.type](SigmaDsl.SigmaProp(sb), SSigmaProp)) + case p: SigmaProp => Nullable(mkConstant[SSigmaProp.type](p, SSigmaProp)) + case coll: Coll[a] => + val tpeItem = Evaluation.rtypeToSType(coll.tItem) + Nullable(mkCollectionConstant(coll.asInstanceOf[SCollection[SType]#WrappedType], tpeItem)) + case _ => + Nullable.None + } + } +} diff --git a/interpreter/shared/src/main/scala/sigmastate/eval/CostingDataContext.scala b/interpreter/shared/src/main/scala/sigmastate/eval/CostingDataContext.scala index b0e1d1ad35..3b0b25090a 100644 --- a/interpreter/shared/src/main/scala/sigmastate/eval/CostingDataContext.scala +++ b/interpreter/shared/src/main/scala/sigmastate/eval/CostingDataContext.scala @@ -649,12 +649,12 @@ class CostingSigmaDslBuilder extends SigmaDslBuilder { dsl => override def substConstants[T](scriptBytes: Coll[Byte], positions: Coll[Int], newValues: Coll[T]): Coll[Byte] = { - val typedNewVals = newValues.toArray.map(v => TransformingSigmaBuilder.liftToConstant(v) match { - case Nullable(v) => v - case _ => sys.error(s"Cannot evaluate substConstants($scriptBytes, $positions, $newValues): cannot lift value $v") - }) - - val (res, _) = SubstConstants.eval(scriptBytes.toArray, positions.toArray, typedNewVals)(validationSettings) + val constants = try newValues.toArrayOfConstants + catch { + case e: Throwable => + throw new RuntimeException(s"Cannot evaluate substConstants($scriptBytes, $positions, $newValues)", e) + } + val (res, _) = SubstConstants.eval(scriptBytes.toArray, positions.toArray, constants)(validationSettings) Colls.fromArray(res) } diff --git a/interpreter/shared/src/main/scala/sigmastate/eval/Extensions.scala b/interpreter/shared/src/main/scala/sigmastate/eval/Extensions.scala index 9938129f5e..2b5b4bcd91 100644 --- a/interpreter/shared/src/main/scala/sigmastate/eval/Extensions.scala +++ b/interpreter/shared/src/main/scala/sigmastate/eval/Extensions.scala @@ -1,18 +1,19 @@ package sigmastate.eval -import java.math.BigInteger -import scalan.RType -import sigmastate.{SCollection, SCollectionType, SType} -import sigmastate.Values.{Constant, ConstantNode} -import sigmastate.lang.CheckingSigmaBuilder -import special.collection.Coll -import special.sigma._ -import sigmastate.SType.AnyOps +import debox.{cfor, Buffer => DBuffer} import org.ergoplatform.ErgoBox -import debox.{Buffer => DBuffer} -import debox.cfor import org.ergoplatform.ErgoBox.TokenId +import scalan.{Nullable, RType} +import sigmastate.SType.AnyOps +import sigmastate.Values.{Constant, ConstantNode} import sigmastate.crypto.{CryptoFacade, Ecp} +import sigmastate.lang.{CheckingSigmaBuilder, TransformingSigmaBuilder} +import sigmastate.utils.Helpers +import sigmastate.{Platform, SCollection, SCollectionType, SType} +import special.collection.Coll +import special.sigma._ + +import java.math.BigInteger object Extensions { private val Colls = CostingSigmaDslBuilder.Colls @@ -55,6 +56,29 @@ object Extensions { val elemTpe = Evaluation.rtypeToSType(coll.tItem).asInstanceOf[ElemTpe] ConstantNode[SCollection[ElemTpe]](coll, SCollectionType(elemTpe)) } + + /** Transforms this collection into array of constants. + * + * This method have exactly the same semantics on JS and JVM IF `coll.tItem` + * precisely describes the type of elements in `call`. (Which is the case for all + * collections created by ErgoTree interpreter). + * + * However it is not the case, then JVM and JS will have different semantics for Byte and Short. + * + * The JVM version preserves v5.0 consensus protocol semantics. + * The JS version is a reasonable approximation of the JVM version. + */ + def toArrayOfConstants: Array[Constant[SType]] = { + val constants = coll.toArray.map { v => + val valToLift = Helpers.ensureTypeCarringValue(v, coll.tItem.asInstanceOf[RType[Any]]) + // call platform-specific method to transform the value to a Constant + Platform.liftToConstant(valToLift, TransformingSigmaBuilder) match { + case Nullable(c) => c + case _ => sys.error(s"Cannot liftToConstant($valToLift)") + } + } + constants + } } implicit class DslDataOps[A](data: A)(implicit tA: RType[A]) { diff --git a/interpreter/shared/src/main/scala/sigmastate/lang/SigmaBuilder.scala b/interpreter/shared/src/main/scala/sigmastate/lang/SigmaBuilder.scala index 6d7c3552d4..99bc448c08 100644 --- a/interpreter/shared/src/main/scala/sigmastate/lang/SigmaBuilder.scala +++ b/interpreter/shared/src/main/scala/sigmastate/lang/SigmaBuilder.scala @@ -19,6 +19,7 @@ import sigmastate.lang.Terms.STypeSubst import sigmastate.serialization.OpCodes.OpCode import special.sigma.{AnyValue, AvlTree, GroupElement, SigmaProp} import debox.cfor +import sigmastate.utils.Helpers import scala.util.DynamicVariable @@ -229,69 +230,13 @@ abstract class SigmaBuilder { */ def liftAny(obj: Any): Nullable[SValue] = obj match { case v: SValue => Nullable(v) + case av: AnyValue if Environment.current.isJVM => + // on JVM we must use the wrapped value directly + Platform.liftToConstant(av.value, this) case _ => - liftToConstant(obj) + Platform.liftToConstant(obj, this) } - /** Created a new Constant instance with an appropriate type derived from the given data `obj`. - * Uses scalan.Nullable instead of scala.Option to avoid allocation on consensus hot path. - */ - def liftToConstant(obj: Any): Nullable[Constant[SType]] = obj match { - case arr: Array[Boolean] => Nullable(mkCollectionConstant[SBoolean.type](arr, SBoolean)) - case arr: Array[Byte] => Nullable(mkCollectionConstant[SByte.type](arr, SByte)) - case arr: Array[Short] => Nullable(mkCollectionConstant[SShort.type](arr, SShort)) - case arr: Array[Int] => Nullable(mkCollectionConstant[SInt.type](arr, SInt)) - case arr: Array[Long] => Nullable(mkCollectionConstant[SLong.type](arr, SLong)) - case arr: Array[BigInteger] => Nullable(mkCollectionConstant[SBigInt.type](arr.map(SigmaDsl.BigInt(_)), SBigInt)) - case arr: Array[String] => Nullable(mkCollectionConstant[SString.type](arr, SString)) - case v: AnyValue => - val tpe = Evaluation.rtypeToSType(v.tVal) - Nullable(mkConstant[tpe.type](v.value.asInstanceOf[tpe.WrappedType], tpe)) -// case v: Byte => Nullable(mkConstant[SByte.type](v, SByte)) -// case v: Short => Nullable(mkConstant[SShort.type](v, SShort)) - case v: Int => Nullable(mkConstant[SInt.type](v, SInt)) - case v: Long => Nullable(mkConstant[SLong.type](v, SLong)) - - case v: BigInteger => Nullable(mkConstant[SBigInt.type](SigmaDsl.BigInt(v), SBigInt)) - case n: special.sigma.BigInt => Nullable(mkConstant[SBigInt.type](n, SBigInt)) - - case ge: GroupElement => Nullable(mkConstant[SGroupElement.type](ge, SGroupElement)) - - case b: Boolean => Nullable(if(b) TrueLeaf else FalseLeaf) - case v: String => Nullable(mkConstant[SString.type](v, SString)) - - // The Box lifting was broken in v4.x. `SigmaDsl.Box(b)` was missing which means the - // isCorrectType requirement would fail in ConstantNode constructor. - // This method is used as part of consensus in SubstConstants operation, however - // ErgoBox cannot be passed as argument as it is never valid value during evaluation. - // Thus we can use activation-based versioning and fix this code when v5.0 is activated. - case b: ErgoBox => - if (VersionContext.current.isJitActivated) - Nullable(mkConstant[SBox.type](SigmaDsl.Box(b), SBox)) // fixed in v5.0 - else - Nullable(mkConstant[SBox.type](b, SBox)) // same as in v4.x, i.e. broken - - // this case is added in v5.0 and it can be useful when the box value comes from a - // register or a context variable is passed to SubstConstants. - case b: special.sigma.Box => - if (VersionContext.current.isJitActivated) - Nullable(mkConstant[SBox.type](b, SBox)) - else - Nullable.None // return the same result as in v4.x when there was no this case - - case avl: AvlTreeData => Nullable(mkConstant[SAvlTree.type](SigmaDsl.avlTree(avl), SAvlTree)) - case avl: AvlTree => Nullable(mkConstant[SAvlTree.type](avl, SAvlTree)) - - case sb: SigmaBoolean => Nullable(mkConstant[SSigmaProp.type](SigmaDsl.SigmaProp(sb), SSigmaProp)) - case p: SigmaProp => Nullable(mkConstant[SSigmaProp.type](p, SSigmaProp)) - - case coll: Coll[a] => - val tpeItem = Evaluation.rtypeToSType(coll.tItem) - Nullable(mkCollectionConstant(coll.asInstanceOf[SCollection[SType]#WrappedType], tpeItem)) - - case _ => - sys.error(s"Cannot liftToConstant($obj)") - } } /** Standard implementation of [[SigmaBuilder]] interface in which most of the operations diff --git a/interpreter/shared/src/main/scala/sigmastate/trees.scala b/interpreter/shared/src/main/scala/sigmastate/trees.scala index 432b65762f..0d60fa1b74 100644 --- a/interpreter/shared/src/main/scala/sigmastate/trees.scala +++ b/interpreter/shared/src/main/scala/sigmastate/trees.scala @@ -27,8 +27,8 @@ import special.sigma.{GroupElement, SigmaProp} import scala.collection.mutable import scala.collection.mutable.ArrayBuffer -import scala.collection.compat.immutable.ArraySeq import debox.cfor +import sigmastate.eval.Extensions.EvalCollOps /** * Basic trait for inner nodes of crypto-trees, so AND/OR/THRESHOLD sigma-protocol connectives @@ -774,12 +774,12 @@ case class SubstConstants[T <: SType](scriptBytes: Value[SByteArray], positions: val newValuesV = newValues.evalTo[Coll[T#WrappedType]](env) var res: Coll[Byte] = null E.addSeqCost(SubstConstants.costKind, SubstConstants.opDesc) { () => - val typedNewVals: Array[Constant[SType]] = newValuesV.toArray.map { v => - TransformingSigmaBuilder.liftToConstant(v) match { - case Nullable(v) => v - case _ => sys.error(s"Cannot evaluate substConstants($scriptBytesV, $positionsV, $newValuesV): cannot lift value $v") + val typedNewVals: Array[Constant[SType]] = + try newValuesV.toArrayOfConstants + catch { + case e: Throwable => + throw new RuntimeException(s"Cannot evaluate substConstants($scriptBytesV, $positionsV, $newValuesV)", e) } - } val (newBytes, nConstants) = SubstConstants.eval( scriptBytes = scriptBytesV.toArray, diff --git a/interpreter/shared/src/main/scala/sigmastate/utils/Helpers.scala b/interpreter/shared/src/main/scala/sigmastate/utils/Helpers.scala index f3e6eddda1..df775cbecf 100644 --- a/interpreter/shared/src/main/scala/sigmastate/utils/Helpers.scala +++ b/interpreter/shared/src/main/scala/sigmastate/utils/Helpers.scala @@ -2,8 +2,10 @@ package sigmastate.utils import io.circe.Decoder import org.ergoplatform.settings.ErgoAlgos +import scalan.{OverloadHack, RType} import scorex.utils.Ints -import sigmastate.eval.{Colls, SigmaDsl} +import sigmastate.Environment +import sigmastate.eval.{CAnyValue, Colls, SigmaDsl} import sigmastate.basics.CryptoConstants.EcPointType import special.collection.Coll import special.sigma.GroupElement @@ -160,6 +162,22 @@ object Helpers { } res } + + /** Encapsulate platform-specific logic of ensuring the value carries its precise type. + * For JVM this is identity function. + * For JS it can transform to AnyValue, if the type is numeric + */ + def ensureTypeCarringValue(v: Any, tT: RType[Any]): Any = + if (Environment.current.isJVM) v + else { // JS + v match { + case _: Byte | _: Short | _: Int => + // this is necessary for JS where Byte, Short, Int have the same runtime class + // and hence we need to pass the type information explicitly + CAnyValue(v)(tT, OverloadHack.overloaded1) + case _ => v + } + } } object Overloading { diff --git a/sc/shared/src/test/scala/sigmastate/lang/SigmaBuilderTest.scala b/sc/shared/src/test/scala/sigmastate/lang/SigmaBuilderTest.scala index 832a5bb11d..b505a02a95 100644 --- a/sc/shared/src/test/scala/sigmastate/lang/SigmaBuilderTest.scala +++ b/sc/shared/src/test/scala/sigmastate/lang/SigmaBuilderTest.scala @@ -70,4 +70,9 @@ class SigmaBuilderTest extends AnyPropSpec with ScalaCheckPropertyChecks with Ma an[ConstraintFailed] should be thrownBy mkDivide(LongConstant(1), IntConstant(1)) an[ConstraintFailed] should be thrownBy mkModulo(LongConstant(1), IntConstant(1)) } + + property("liftToConstant") { + import TransformingSigmaBuilder._ +// liftToConstant(1.toByte) shouldBe ByteConstant(1) + } } From 7cfdd48d80f6c454fa03ab654b5bf4aa6a2a285b Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Fri, 16 Jun 2023 23:49:12 +0200 Subject: [PATCH 13/58] compiler-js: return TypesSpecification.scala to shared --- .../DeserializationResilience.scala | 31 ----------------- .../scala/sigmastate/TypesSpecification.scala | 25 +++++++++++--- .../DeserializationResilience.scala | 33 +++++++++++++++---- 3 files changed, 46 insertions(+), 43 deletions(-) delete mode 100644 sc/jvm/src/test/scala/sigmastate/serialization/DeserializationResilience.scala rename sc/{jvm => shared}/src/test/scala/sigmastate/TypesSpecification.scala (88%) diff --git a/sc/jvm/src/test/scala/sigmastate/serialization/DeserializationResilience.scala b/sc/jvm/src/test/scala/sigmastate/serialization/DeserializationResilience.scala deleted file mode 100644 index 0704d31724..0000000000 --- a/sc/jvm/src/test/scala/sigmastate/serialization/DeserializationResilience.scala +++ /dev/null @@ -1,31 +0,0 @@ -package sigmastate.serialization - -import sigmastate.Values.IntConstant -import sigmastate._ - -class DeserializationResilienceJvm extends DeserializationResilienceTesting { - - implicit lazy val IR: TestingIRContext = new TestingIRContext { - // substFromCostTable = false - saveGraphsInFile = false - // override val okPrintEvaluatedEntries = true - } - - property("reader.level correspondence to the serializer recursive call depth") { - forAll(logicalExprTreeNodeGen(Seq(AND.apply, OR.apply))) { expr => - val (callDepths, levels) = traceReaderCallDepth(expr) - callDepths shouldEqual levels - } - forAll(numExprTreeNodeGen) { numExpr => - val expr = EQ(numExpr, IntConstant(1)) - val (callDepths, levels) = traceReaderCallDepth(expr) - callDepths shouldEqual levels - } - forAll(sigmaBooleanGen) { sigmaBool => - val (callDepths, levels) = traceReaderCallDepth(sigmaBool) - callDepths shouldEqual levels - } - } - - -} diff --git a/sc/jvm/src/test/scala/sigmastate/TypesSpecification.scala b/sc/shared/src/test/scala/sigmastate/TypesSpecification.scala similarity index 88% rename from sc/jvm/src/test/scala/sigmastate/TypesSpecification.scala rename to sc/shared/src/test/scala/sigmastate/TypesSpecification.scala index 90bea47d61..9baabf79c9 100644 --- a/sc/jvm/src/test/scala/sigmastate/TypesSpecification.scala +++ b/sc/shared/src/test/scala/sigmastate/TypesSpecification.scala @@ -36,14 +36,29 @@ class TypesSpecification extends SigmaTestingData { assertFalse(true, SByte) assertTrue(0.toByte, SByte) - assertFalse(0.toByte, SShort) // TODO JS: this and the other similar cases below fail on JS - + + if (Environment.current.isJVM) { + assertFalse(0.toByte, SShort) + } else { // JS + assertTrue(0.toByte, SShort) + } + assertTrue(0.toShort, SShort) - assertFalse(0.toShort, SInt) - + + if (Environment.current.isJVM) { + assertFalse(0.toShort, SInt) + } else { // JS + assertTrue(0.toShort, SInt) + } + assertTrue(0, SInt) - assertFalse(0, SShort) + if (Environment.current.isJVM) { + assertFalse(0, SShort) + } else { // JS + assertTrue(0, SShort) + } + assertTrue(0L, SLong) assertFalse(0L, SShort) diff --git a/sc/shared/src/test/scala/sigmastate/serialization/DeserializationResilience.scala b/sc/shared/src/test/scala/sigmastate/serialization/DeserializationResilience.scala index 39682e92f3..ebc802c441 100644 --- a/sc/shared/src/test/scala/sigmastate/serialization/DeserializationResilience.scala +++ b/sc/shared/src/test/scala/sigmastate/serialization/DeserializationResilience.scala @@ -1,31 +1,32 @@ package sigmastate.serialization -import java.nio.ByteBuffer import org.ergoplatform.validation.ValidationException import org.ergoplatform.validation.ValidationRules.CheckPositionLimit import org.ergoplatform.{ErgoBoxCandidate, Outputs} import org.scalacheck.Gen import scalan.util.BenchmarkUtil -import scorex.crypto.authds.{ADKey, ADValue} import scorex.crypto.authds.avltree.batch.{BatchAVLProver, Insert} +import scorex.crypto.authds.{ADKey, ADValue} import scorex.crypto.hash.{Blake2b256, Digest32} import scorex.util.serialization.{Reader, VLQByteBufferReader} -import sigmastate.Values.{SValue, BlockValue, GetVarInt, SigmaBoolean, ValDef, ValUse, SigmaPropValue, Tuple, IntConstant} +import sigmastate.Values.{BlockValue, GetVarInt, IntConstant, SValue, SigmaBoolean, SigmaPropValue, Tuple, ValDef, ValUse} import sigmastate._ import sigmastate.basics.CryptoConstants import sigmastate.eval.Extensions._ import sigmastate.eval._ -import sigmastate.exceptions.{ReaderPositionLimitExceeded, InvalidTypePrefix, SerializerException, DeserializeCallDepthExceeded} -import sigmastate.helpers.{ErgoLikeContextTesting, ErgoLikeTestInterpreter, CompilerTestingCommons} +import sigmastate.exceptions.{DeserializeCallDepthExceeded, InvalidTypePrefix, ReaderPositionLimitExceeded, SerializerException} +import sigmastate.helpers.{CompilerTestingCommons, ErgoLikeContextTesting, ErgoLikeTestInterpreter} import sigmastate.interpreter.{ContextExtension, CostedProverResult} import sigmastate.serialization.OpCodes._ import sigmastate.util.safeNewArray +import sigmastate.utils.Helpers._ import sigmastate.utils.SigmaByteReader import sigmastate.utxo.SizeOf -import sigmastate.utils.Helpers._ +import java.nio.ByteBuffer +import scala.collection.immutable.Seq import scala.collection.mutable -import scala.util.{Try, Success, Failure} +import scala.util.{Failure, Success, Try} trait DeserializationResilienceTesting extends SerializationSpecification with CompilerTestingCommons with CompilerCrossVersionProps { @@ -196,6 +197,24 @@ class DeserializationResilience extends DeserializationResilienceTesting { ValueSerializer.deserialize(Array.fill[Byte](1)(117.toByte)) } + property("reader.level correspondence to the serializer recursive call depth") { + if (Environment.current.isJVM) { + forAll(logicalExprTreeNodeGen(Seq(AND.apply, OR.apply))) { expr => + val (callDepths, levels) = traceReaderCallDepth(expr) + callDepths shouldEqual levels + } + forAll(numExprTreeNodeGen) { numExpr => + val expr = EQ(numExpr, IntConstant(1)) + val (callDepths, levels) = traceReaderCallDepth(expr) + callDepths shouldEqual levels + } + forAll(sigmaBooleanGen) { sigmaBool => + val (callDepths, levels) = traceReaderCallDepth(sigmaBool) + callDepths shouldEqual levels + } + } + } + property("reader.level is updated in ValueSerializer.deserialize") { val expr = SizeOf(Outputs) val (callDepths, levels) = traceReaderCallDepth(expr) From ba23ca5e13cd7ad1c92038881f0b71523170fd05 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Sat, 17 Jun 2023 11:17:59 +0200 Subject: [PATCH 14/58] compiler-js: fix compilation --- interpreter/shared/src/main/scala/sigmastate/Values.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interpreter/shared/src/main/scala/sigmastate/Values.scala b/interpreter/shared/src/main/scala/sigmastate/Values.scala index 62543daa51..c2b6de9823 100644 --- a/interpreter/shared/src/main/scala/sigmastate/Values.scala +++ b/interpreter/shared/src/main/scala/sigmastate/Values.scala @@ -33,7 +33,6 @@ import sigmastate.utils.{SigmaByteReader, SigmaByteWriter} import special.sigma.{AvlTree, Header, PreHeader, _} import sigmastate.lang.SourceContext import sigmastate.util.safeNewArray -import sigmastate.crypto.Platform import special.collection.Coll import scala.collection.compat.immutable.ArraySeq @@ -324,7 +323,8 @@ object Values { * @see Constant */ case class ConstantNode[S <: SType](value: S#WrappedType, tpe: S) extends Constant[S] { - require(Platform.isCorrectType(value, tpe), s"Invalid type of constant value $value, expected type $tpe") + require(sigmastate.crypto.Platform.isCorrectType(value, tpe), + s"Invalid type of constant value $value, expected type $tpe") override def companion: ValueCompanion = Constant override def opCode: OpCode = companion.opCode override def opName: String = s"Const" From db4ee8ac80e83b2823bc32c2232b301697cca60c Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Sat, 17 Jun 2023 16:39:05 +0200 Subject: [PATCH 15/58] compiler-js: tests for liftToConstant --- .../src/main/scala/scalan/AnyVals.scala | 1 + .../src/main/scala/sigmastate/Platform.scala | 2 +- .../src/main/scala/sigmastate/Platform.scala | 2 +- .../scala/sigmastate/lang/SigmaBuilder.scala | 22 +- .../sigmastate/lang/SigmaBuilderTest.scala | 256 ++++++++++++++++++ .../sigmastate/lang/SigmaBuilderTest.scala | 78 ------ 6 files changed, 268 insertions(+), 93 deletions(-) create mode 100644 interpreter/shared/src/test/scala/sigmastate/lang/SigmaBuilderTest.scala delete mode 100644 sc/shared/src/test/scala/sigmastate/lang/SigmaBuilderTest.scala diff --git a/common/shared/src/main/scala/scalan/AnyVals.scala b/common/shared/src/main/scala/scalan/AnyVals.scala index b77aa943de..ca0887401e 100644 --- a/common/shared/src/main/scala/scalan/AnyVals.scala +++ b/common/shared/src/main/scala/scalan/AnyVals.scala @@ -14,6 +14,7 @@ class Nullable[+T](val x: T) extends AnyVal { @inline final def getOrElse[B >: T](default: =>B): B = if (x != null) x else default @inline final def toList: List[T] = if (x == null) Nil else x :: Nil @inline final def toOption: Option[T] = if (x == null) None else Some(x) + override def toString = if (x == null) "None" else s"Nullable($x)" } object Nullable { final val None: Nullable[Null] = new Nullable(null) diff --git a/interpreter/js/src/main/scala/sigmastate/Platform.scala b/interpreter/js/src/main/scala/sigmastate/Platform.scala index 8dbdecb3e0..98cf6a9ea3 100644 --- a/interpreter/js/src/main/scala/sigmastate/Platform.scala +++ b/interpreter/js/src/main/scala/sigmastate/Platform.scala @@ -15,7 +15,7 @@ object Platform { * Uses scalan.Nullable instead of scala.Option to avoid allocation on consensus hot path. * This method is part of consensus and is used in [[SubstConstants]] operation. */ - def liftToConstant(obj: Any, builder: SigmaBuilder): Nullable[Constant[SType]] = { + private [sigmastate] def liftToConstant(obj: Any, builder: SigmaBuilder): Nullable[Constant[SType]] = { import builder._ obj match { case arr: Array[Boolean] => Nullable(mkCollectionConstant[SBoolean.type](arr, SBoolean)) diff --git a/interpreter/jvm/src/main/scala/sigmastate/Platform.scala b/interpreter/jvm/src/main/scala/sigmastate/Platform.scala index 703940ca45..d14c66da5c 100644 --- a/interpreter/jvm/src/main/scala/sigmastate/Platform.scala +++ b/interpreter/jvm/src/main/scala/sigmastate/Platform.scala @@ -15,7 +15,7 @@ object Platform { * Uses scalan.Nullable instead of scala.Option to avoid allocation on consensus hot path. * This method is part of consensus and is used in [[SubstConstants]] operation. */ - def liftToConstant(obj: Any, builder: SigmaBuilder): Nullable[Constant[SType]] = { + private [sigmastate] def liftToConstant(obj: Any, builder: SigmaBuilder): Nullable[Constant[SType]] = { import builder._ obj match { case arr: Array[Boolean] => Nullable(mkCollectionConstant[SBoolean.type](arr, SBoolean)) diff --git a/interpreter/shared/src/main/scala/sigmastate/lang/SigmaBuilder.scala b/interpreter/shared/src/main/scala/sigmastate/lang/SigmaBuilder.scala index 99bc448c08..813664931d 100644 --- a/interpreter/shared/src/main/scala/sigmastate/lang/SigmaBuilder.scala +++ b/interpreter/shared/src/main/scala/sigmastate/lang/SigmaBuilder.scala @@ -1,25 +1,21 @@ package sigmastate.lang -import java.math.BigInteger -import org.ergoplatform.ErgoBox +import debox.cfor import org.ergoplatform.ErgoBox.RegisterId +import scalan.Nullable import sigmastate.SCollection.{SByteArray, SIntArray} +import sigmastate.SOption.SIntOption import sigmastate.Values._ import sigmastate._ -import sigmastate.lang.Constraints._ -import sigmastate.lang.Terms._ +import sigmastate.eval._ import sigmastate.exceptions.ConstraintFailed +import sigmastate.lang.Constraints._ +import sigmastate.lang.Terms.{STypeSubst, _} import sigmastate.serialization.OpCodes +import sigmastate.serialization.OpCodes.OpCode import sigmastate.utxo._ -import scalan.Nullable -import sigmastate.SOption.SIntOption -import sigmastate.eval._ import special.collection.Coll -import sigmastate.lang.Terms.STypeSubst -import sigmastate.serialization.OpCodes.OpCode -import special.sigma.{AnyValue, AvlTree, GroupElement, SigmaProp} -import debox.cfor -import sigmastate.utils.Helpers +import special.sigma.AnyValue import scala.util.DynamicVariable @@ -226,7 +222,7 @@ abstract class SigmaBuilder { /** Created a new Value instance with an appropriate type derived from the given data `obj`. * If `obj` is already Value, then it is returned as result. - * Uses scalan.Nullable instead of scala.Option to avoid allocation on consensus hot path. + * Uses [[scalan.Nullable]] instead of [[Option]] to avoid allocation on consensus hot path. */ def liftAny(obj: Any): Nullable[SValue] = obj match { case v: SValue => Nullable(v) diff --git a/interpreter/shared/src/test/scala/sigmastate/lang/SigmaBuilderTest.scala b/interpreter/shared/src/test/scala/sigmastate/lang/SigmaBuilderTest.scala new file mode 100644 index 0000000000..7015587e34 --- /dev/null +++ b/interpreter/shared/src/test/scala/sigmastate/lang/SigmaBuilderTest.scala @@ -0,0 +1,256 @@ +package sigmastate.lang + +import org.scalatest.matchers.should.Matchers +import org.scalatest.propspec.AnyPropSpec +import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks +import scalan.{Nullable, RType} +import sigmastate.Values._ +import sigmastate._ +import sigmastate.eval.Extensions.ArrayOps +import sigmastate.eval.{CAnyValue, CAvlTree, CostingBox, SigmaDsl} +import sigmastate.exceptions.ConstraintFailed +import sigmastate.serialization.OpCodes +import special.sigma.SigmaTestingData + +import java.math.BigInteger + +class SigmaBuilderTest extends AnyPropSpec with ScalaCheckPropertyChecks with Matchers + with SigmaTestingData + with CrossVersionProps { + + property("StdSigmaBuilder construct nodes") { + import StdSigmaBuilder._ + mkEQ(TrueLeaf, FalseLeaf) shouldEqual EQ(TrueLeaf, FalseLeaf) + mkNEQ(TrueLeaf, FalseLeaf) shouldEqual NEQ(TrueLeaf, FalseLeaf) + + mkGT(IntConstant(1), IntConstant(1)) shouldEqual GT(IntConstant(1), IntConstant(1)) + mkGE(IntConstant(1), IntConstant(1)) shouldEqual GE(IntConstant(1), IntConstant(1)) + mkLT(IntConstant(1), IntConstant(1)) shouldEqual LT(IntConstant(1), IntConstant(1)) + mkLE(IntConstant(1), IntConstant(1)) shouldEqual LE(IntConstant(1), IntConstant(1)) + + mkPlus(IntConstant(1), IntConstant(1)) shouldEqual + ArithOp(IntConstant(1), IntConstant(1), OpCodes.PlusCode) + mkMinus(IntConstant(1), IntConstant(1)) shouldEqual + ArithOp(IntConstant(1), IntConstant(1), OpCodes.MinusCode) + mkMultiply(IntConstant(1), IntConstant(1)) shouldEqual + ArithOp(IntConstant(1), IntConstant(1), OpCodes.MultiplyCode) + mkDivide(IntConstant(1), IntConstant(1)) shouldEqual + ArithOp(IntConstant(1), IntConstant(1), OpCodes.DivisionCode) + mkModulo(IntConstant(1), IntConstant(1)) shouldEqual + ArithOp(IntConstant(1), IntConstant(1), OpCodes.ModuloCode) + } + + property("TransformingSigmaBuilder apply upcast") { + import TransformingSigmaBuilder._ + mkEQ(LongConstant(1), IntConstant(1)) shouldEqual EQ(LongConstant(1), Upcast(IntConstant(1), SLong)) + mkNEQ(LongConstant(1), IntConstant(1)) shouldEqual NEQ(LongConstant(1), Upcast(IntConstant(1), SLong)) + + mkGT(LongConstant(1), IntConstant(1)) shouldEqual GT(LongConstant(1), Upcast(IntConstant(1), SLong)) + mkGE(LongConstant(1), IntConstant(1)) shouldEqual GE(LongConstant(1), Upcast(IntConstant(1), SLong)) + mkLT(LongConstant(1), IntConstant(1)) shouldEqual LT(LongConstant(1), Upcast(IntConstant(1), SLong)) + mkLE(LongConstant(1), IntConstant(1)) shouldEqual LE(LongConstant(1), Upcast(IntConstant(1), SLong)) + + mkPlus(LongConstant(1), IntConstant(1)) shouldEqual + ArithOp(LongConstant(1), Upcast(IntConstant(1), SLong), OpCodes.PlusCode) + mkMinus(LongConstant(1), IntConstant(1)) shouldEqual + ArithOp(LongConstant(1), Upcast(IntConstant(1), SLong), OpCodes.MinusCode) + mkMultiply(LongConstant(1), IntConstant(1)) shouldEqual + ArithOp(LongConstant(1), Upcast(IntConstant(1), SLong), OpCodes.MultiplyCode) + mkDivide(LongConstant(1), IntConstant(1)) shouldEqual + ArithOp(LongConstant(1), Upcast(IntConstant(1), SLong), OpCodes.DivisionCode) + mkModulo(LongConstant(1), IntConstant(1)) shouldEqual + ArithOp(LongConstant(1), Upcast(IntConstant(1), SLong), OpCodes.ModuloCode) + } + + property("CheckingSigmaBuilder failing constraint") { + import CheckingSigmaBuilder._ + an[ConstraintFailed] should be thrownBy mkEQ(LongConstant(1), IntConstant(1)) + an[ConstraintFailed] should be thrownBy mkNEQ(LongConstant(1), IntConstant(1)) + + an[ConstraintFailed] should be thrownBy mkGT(LongConstant(1), IntConstant(1)) + an[ConstraintFailed] should be thrownBy mkGE(LongConstant(1), IntConstant(1)) + an[ConstraintFailed] should be thrownBy mkLT(LongConstant(1), IntConstant(1)) + an[ConstraintFailed] should be thrownBy mkLE(LongConstant(1), IntConstant(1)) + + an[ConstraintFailed] should be thrownBy mkPlus(LongConstant(1), IntConstant(1)) + an[ConstraintFailed] should be thrownBy mkMinus(LongConstant(1), IntConstant(1)) + an[ConstraintFailed] should be thrownBy mkMultiply(LongConstant(1), IntConstant(1)) + an[ConstraintFailed] should be thrownBy mkDivide(LongConstant(1), IntConstant(1)) + an[ConstraintFailed] should be thrownBy mkModulo(LongConstant(1), IntConstant(1)) + } + import Platform.liftToConstant + + def testSuccess(v: Any, c: Constant[SType]): Unit = { + liftToConstant(v, TransformingSigmaBuilder) shouldBe Nullable(c) + } + + def testFailure(v: Any): Unit = { + liftToConstant(v, TransformingSigmaBuilder) shouldBe Nullable.None + } + + def testNumeric[T <: SType] + (v: T#WrappedType, c: Constant[T]) = { + if (Environment.current.isJVM) { + testSuccess(v, c) + } else { + // Byte, Short, Int are the same on JS and thus lifted to IntConstant + testSuccess(v, IntConstant(1)) + } + } + + /** Test behavior of platform-specific liftToConstant method on CAnyValue. */ + def testLiftingOfCAnyValue[T <: SType] + (v: T#WrappedType, c: Constant[T])(implicit t: RType[T#WrappedType]) = { + if (Environment.current.isJVM) { + // behavior on JVM is consensus critical, make sure lifitng of CAnyValue is failing + testFailure(CAnyValue(v)) + } else { + // JS version however handles lifiting of CAnyValue + testSuccess(CAnyValue(v), c) + } + } + + def test[T <: SType] + (v: T#WrappedType, c: Constant[T])(implicit t: RType[T#WrappedType]) = { + testSuccess(v, c) + testLiftingOfCAnyValue[T](v, c) + } + + def testArray[T <: SType] + (v: T#WrappedType, c: Constant[T])(implicit t: RType[T#WrappedType]) = { + // for any Byte and Short value `v`, lifting of array should succeed + val arr = Array.fill[T#WrappedType](10)(v)(t.classTag) + testSuccess(arr, TransformingSigmaBuilder.mkCollectionConstant(arr, c.tpe)) + } + + def testColl[T <: SType] + (v: T#WrappedType, c: Constant[T])(implicit t: RType[T#WrappedType]) = { + // for any Byte and Short value `v`, lifting of Coll should succeed + val arr = Array.fill[T#WrappedType](10)(v)(t.classTag) + val coll = arr.toColl + testSuccess(coll, TransformingSigmaBuilder.mkCollectionConstant(coll, c.tpe)) + } + + property("liftToConstant Boolean") { + val v = true + val c = BooleanConstant(v) + test[SBoolean.type](v, c) + testArray[SBoolean.type](v, c) // TODO v6.0: arrays should not be liftable directly + testColl[SBoolean.type](v, c) + } + + property("liftToConstant Byte") { + val v = 1.toByte + val c = ByteConstant(v) + testNumeric[SByte.type](v, c) + testLiftingOfCAnyValue[SByte.type](v, c) + testArray[SByte.type](v, c) // TODO v6.0: arrays should not be liftable directly + testColl[SByte.type](v, c) + } + + property("liftToConstant Short") { + val v = 1.toShort + val c = ShortConstant(v) + testNumeric[SShort.type](v, c) + testLiftingOfCAnyValue[SShort.type](v, c) + testArray[SShort.type](v, c) // TODO v6.0: arrays should not be liftable directly + testColl[SShort.type](v, c) + } + + property("liftToConstant Int") { + val v = 1 + val c = IntConstant(v) + test[SInt.type](v, c) + testArray[SInt.type](v, c) // TODO v6.0: arrays should not be liftable directly + testColl[SInt.type](v, c) + } + + property("liftToConstant Long") { + val v = 1L + val c = LongConstant(v) + test[SLong.type](v, c) + testArray[SLong.type](v, c) // TODO v6.0: arrays should not be liftable directly + testColl[SLong.type](v, c) + } + + property("liftToConstant String") { + val v = "abc" + val c = StringConstant(v) + test[SString.type](v, c) + testArray[SString.type](v, c) // TODO v6.0: String should be liftable at all (not supported in ErgoTree) + testColl[SString.type](v, c) + } + + property("liftToConstant BigInteger") { + val v = BigInteger.valueOf(1L) + val c = BigIntConstant(v) + testSuccess(v, c) // TODO v6.0: both BigInteger and arrays should not be liftable directly + val arr = Array.fill(10)(v) + testSuccess(arr, TransformingSigmaBuilder.mkCollectionConstant[SBigInt.type](arr.map(SigmaDsl.BigInt), c.tpe)) + } + + property("liftToConstant BigInt") { + val v = SigmaDsl.BigInt(BigInteger.valueOf(1L)) + val c = BigIntConstant(v) + test[SBigInt.type](v, c) + testFailure(Array.fill(10)(v), c) + testColl[SBigInt.type](v, c) + } + + property("liftToConstant GroupElement") { + val v = TestData.ge1 + val c = GroupElementConstant(v) + test[SGroupElement.type](v, c) + testFailure(Array.fill(10)(v)) + testColl[SGroupElement.type](v, c) + } + + property("liftToConstant ErgoBox") { + val v = TestData.b2.asInstanceOf[CostingBox].wrappedValue + val c = BoxConstant(TestData.b2) + testSuccess(v, c) // TODO v6.0: ErgoBox should not be liftable directly + testFailure(Array.fill(10)(v)) + } + + property("liftToConstant Box") { + val v = TestData.b2 + val c = BoxConstant(v) + if (VersionContext.current.isJitActivated) { + test[SBox.type](v, c) + } else { + testFailure(v) + } + testFailure(Array.fill(10)(v)) + testColl[SBox.type](v, c) + } + + property("liftToConstant AvlTree") { + val v = TestData.t1 + val c = AvlTreeConstant(v) + test[SAvlTree.type](v, c) + testFailure(Array.fill(10)(v)) + testColl[SAvlTree.type](v, c) + } + + property("liftToConstant AvlTreeData") { + val v = TestData.t1.asInstanceOf[CAvlTree].wrappedValue + val c = AvlTreeConstant(SigmaDsl.avlTree(v)) + testSuccess(v, c) // TODO v6.0: AvlTreeData should not be liftable directly + testFailure(Array.fill(10)(v)) + } + + property("liftToConstant SigmaBoolean") { + val v = TestData.create_dlog() + val c = SigmaPropConstant(v) + testSuccess(v, c) + testFailure(Array.fill(10)(v)) + } + + property("liftToConstant SigmaProp") { + val v = SigmaDsl.SigmaProp(TestData.create_dlog()) + val c = SigmaPropConstant(v) + test[SSigmaProp.type](v, c) + testFailure(Array.fill(10)(v)) + testColl[SSigmaProp.type](v, c) + } +} diff --git a/sc/shared/src/test/scala/sigmastate/lang/SigmaBuilderTest.scala b/sc/shared/src/test/scala/sigmastate/lang/SigmaBuilderTest.scala deleted file mode 100644 index b505a02a95..0000000000 --- a/sc/shared/src/test/scala/sigmastate/lang/SigmaBuilderTest.scala +++ /dev/null @@ -1,78 +0,0 @@ -package sigmastate.lang - -import org.scalatest.matchers.should.Matchers -import org.scalatest.propspec.AnyPropSpec -import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks -import sigmastate.Values._ -import sigmastate._ -import sigmastate.exceptions.ConstraintFailed -import sigmastate.serialization.OpCodes - -class SigmaBuilderTest extends AnyPropSpec with ScalaCheckPropertyChecks with Matchers with LangTests { - - property("StdSigmaBuilder construct nodes") { - import StdSigmaBuilder._ - mkEQ(TrueLeaf, FalseLeaf) shouldEqual EQ(TrueLeaf, FalseLeaf) - mkNEQ(TrueLeaf, FalseLeaf) shouldEqual NEQ(TrueLeaf, FalseLeaf) - - mkGT(IntConstant(1), IntConstant(1)) shouldEqual GT(IntConstant(1), IntConstant(1)) - mkGE(IntConstant(1), IntConstant(1)) shouldEqual GE(IntConstant(1), IntConstant(1)) - mkLT(IntConstant(1), IntConstant(1)) shouldEqual LT(IntConstant(1), IntConstant(1)) - mkLE(IntConstant(1), IntConstant(1)) shouldEqual LE(IntConstant(1), IntConstant(1)) - - mkPlus(IntConstant(1), IntConstant(1)) shouldEqual - ArithOp(IntConstant(1), IntConstant(1), OpCodes.PlusCode) - mkMinus(IntConstant(1), IntConstant(1)) shouldEqual - ArithOp(IntConstant(1), IntConstant(1), OpCodes.MinusCode) - mkMultiply(IntConstant(1), IntConstant(1)) shouldEqual - ArithOp(IntConstant(1), IntConstant(1), OpCodes.MultiplyCode) - mkDivide(IntConstant(1), IntConstant(1)) shouldEqual - ArithOp(IntConstant(1), IntConstant(1), OpCodes.DivisionCode) - mkModulo(IntConstant(1), IntConstant(1)) shouldEqual - ArithOp(IntConstant(1), IntConstant(1), OpCodes.ModuloCode) - } - - property("TransformingSigmaBuilder apply upcast") { - import TransformingSigmaBuilder._ - mkEQ(LongConstant(1), IntConstant(1)) shouldEqual EQ(LongConstant(1), Upcast(IntConstant(1), SLong)) - mkNEQ(LongConstant(1), IntConstant(1)) shouldEqual NEQ(LongConstant(1), Upcast(IntConstant(1), SLong)) - - mkGT(LongConstant(1), IntConstant(1)) shouldEqual GT(LongConstant(1), Upcast(IntConstant(1), SLong)) - mkGE(LongConstant(1), IntConstant(1)) shouldEqual GE(LongConstant(1), Upcast(IntConstant(1), SLong)) - mkLT(LongConstant(1), IntConstant(1)) shouldEqual LT(LongConstant(1), Upcast(IntConstant(1), SLong)) - mkLE(LongConstant(1), IntConstant(1)) shouldEqual LE(LongConstant(1), Upcast(IntConstant(1), SLong)) - - mkPlus(LongConstant(1), IntConstant(1)) shouldEqual - ArithOp(LongConstant(1), Upcast(IntConstant(1), SLong), OpCodes.PlusCode) - mkMinus(LongConstant(1), IntConstant(1)) shouldEqual - ArithOp(LongConstant(1), Upcast(IntConstant(1), SLong), OpCodes.MinusCode) - mkMultiply(LongConstant(1), IntConstant(1)) shouldEqual - ArithOp(LongConstant(1), Upcast(IntConstant(1), SLong), OpCodes.MultiplyCode) - mkDivide(LongConstant(1), IntConstant(1)) shouldEqual - ArithOp(LongConstant(1), Upcast(IntConstant(1), SLong), OpCodes.DivisionCode) - mkModulo(LongConstant(1), IntConstant(1)) shouldEqual - ArithOp(LongConstant(1), Upcast(IntConstant(1), SLong), OpCodes.ModuloCode) - } - - property("CheckingSigmaBuilder failing constraint") { - import CheckingSigmaBuilder._ - an[ConstraintFailed] should be thrownBy mkEQ(LongConstant(1), IntConstant(1)) - an[ConstraintFailed] should be thrownBy mkNEQ(LongConstant(1), IntConstant(1)) - - an[ConstraintFailed] should be thrownBy mkGT(LongConstant(1), IntConstant(1)) - an[ConstraintFailed] should be thrownBy mkGE(LongConstant(1), IntConstant(1)) - an[ConstraintFailed] should be thrownBy mkLT(LongConstant(1), IntConstant(1)) - an[ConstraintFailed] should be thrownBy mkLE(LongConstant(1), IntConstant(1)) - - an[ConstraintFailed] should be thrownBy mkPlus(LongConstant(1), IntConstant(1)) - an[ConstraintFailed] should be thrownBy mkMinus(LongConstant(1), IntConstant(1)) - an[ConstraintFailed] should be thrownBy mkMultiply(LongConstant(1), IntConstant(1)) - an[ConstraintFailed] should be thrownBy mkDivide(LongConstant(1), IntConstant(1)) - an[ConstraintFailed] should be thrownBy mkModulo(LongConstant(1), IntConstant(1)) - } - - property("liftToConstant") { - import TransformingSigmaBuilder._ -// liftToConstant(1.toByte) shouldBe ByteConstant(1) - } -} From d8e4ccdc934f4144769d57284d055b46fb3d38ee Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Sat, 17 Jun 2023 17:32:45 +0200 Subject: [PATCH 16/58] compiler-js: fix compilation --- common/shared/src/main/scala/sigmastate/Environment.scala | 2 +- sc/jvm/src/test/scala/sigmastate/ErgoTreeBenchmarks.scala | 3 +-- sc/jvm/src/test/scala/sigmastate/ReflectionGenerator.scala | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/common/shared/src/main/scala/sigmastate/Environment.scala b/common/shared/src/main/scala/sigmastate/Environment.scala index 41acbc77f5..17415a4a65 100644 --- a/common/shared/src/main/scala/sigmastate/Environment.scala +++ b/common/shared/src/main/scala/sigmastate/Environment.scala @@ -19,6 +19,6 @@ object Environment { implicit val current: Environment = new Environment { override def isJVM: Boolean = runtimePlatform == RuntimePlatform.JVM override def isJS: Boolean = runtimePlatform == RuntimePlatform.JS - override def runtimePlatform: RuntimePlatform = Platform.runtimePlatform + override def runtimePlatform: RuntimePlatform = scalan.reflection.Platform.runtimePlatform } } \ No newline at end of file diff --git a/sc/jvm/src/test/scala/sigmastate/ErgoTreeBenchmarks.scala b/sc/jvm/src/test/scala/sigmastate/ErgoTreeBenchmarks.scala index c672b43e89..da86cbe297 100644 --- a/sc/jvm/src/test/scala/sigmastate/ErgoTreeBenchmarks.scala +++ b/sc/jvm/src/test/scala/sigmastate/ErgoTreeBenchmarks.scala @@ -3,7 +3,6 @@ package sigmastate import debox.cfor import org.scalameter.api.Bench import sigmastate.Values.{IntConstant, SValue} -import sigmastate.crypto.Platform import sigmastate.serialization.OpCodes.PlusCode import special.collections.BenchmarkGens @@ -58,7 +57,7 @@ object ErgoTreeBenchmarks extends Bench.LocalTime with BenchmarkGens { suite: Be measure method "isCorrectType" in { using(sizes) in { size => cfor(0)(_ < size, _ + 1) { i => - Platform.isCorrectType(i, SType.allPredefTypes(i % 10)) + sigmastate.crypto.Platform.isCorrectType(i, SType.allPredefTypes(i % 10)) } } } diff --git a/sc/jvm/src/test/scala/sigmastate/ReflectionGenerator.scala b/sc/jvm/src/test/scala/sigmastate/ReflectionGenerator.scala index ddb84b0904..2d71462966 100644 --- a/sc/jvm/src/test/scala/sigmastate/ReflectionGenerator.scala +++ b/sc/jvm/src/test/scala/sigmastate/ReflectionGenerator.scala @@ -177,13 +177,13 @@ object ReflectionGenerator { } private def collectEmptyClasses = { - Platform.unknownClasses.toSeq.filter(e => + scalan.reflection.Platform.unknownClasses.toSeq.filter(e => isEmpty(e._2) && // don't contain constructors, fields or methods !CommonReflection.classes.contains(e._1)) // not already registered } private def collectNonEmptyClasses = { - Platform.unknownClasses.toSeq.filter(e => + scalan.reflection.Platform.unknownClasses.toSeq.filter(e => !isEmpty(e._2) && !CommonReflection.classes.contains(e._1)) } From 7bd9bab20366595853efab1ac0dfe35b2b89a2a8 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Mon, 26 Jun 2023 17:22:29 +0200 Subject: [PATCH 17/58] compiler-js: reconfigure ScalablyTyped and update scrypto dep to SNAPSHOT --- build.sbt | 14 +++++++------- project/build.properties | 2 +- project/plugins.sbt | 6 +++--- .../main/scala/org/ergoplatform/sdk/js/Isos.scala | 12 ++++++------ .../org/ergoplatform/sdk/js/SigmaProver.scala | 4 ++-- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/build.sbt b/build.sbt index 8d68f0de0c..ec9c23bd52 100644 --- a/build.sbt +++ b/build.sbt @@ -82,9 +82,9 @@ ThisBuild / dynverSeparator := "-" val bouncycastleBcprov = "org.bouncycastle" % "bcprov-jdk15on" % "1.66" -val scrypto = "org.scorexfoundation" %% "scrypto" % "2.3.0" +val scrypto = "org.scorexfoundation" %% "scrypto" % "2.3.0-1-72a841a6-SNAPSHOT" val scryptoDependency = - libraryDependencies += "org.scorexfoundation" %%% "scrypto" % "2.3.0" + libraryDependencies += "org.scorexfoundation" %%% "scrypto" % "2.3.0-1-72a841a6-SNAPSHOT" val scorexUtil = "org.scorexfoundation" %% "scorex-util" % "0.2.0" val scorexUtilDependency = @@ -186,7 +186,7 @@ lazy val commonDependenies2 = libraryDependencies ++= Seq( "org.scala-lang.modules" %%% "scala-collection-compat" % "2.7.0" ) -val sigmajsCryptoFacadeVersion = "0.0.5" +val sigmajsCryptoFacadeVersion = "0.0.6" lazy val common = crossProject(JVMPlatform, JSPlatform) .in(file("common")) @@ -274,16 +274,16 @@ lazy val interpreter = crossProject(JVMPlatform, JSPlatform) ) lazy val interpreterJS = interpreter.js .enablePlugins(ScalaJSBundlerPlugin) - .enablePlugins(ScalablyTypedConverterExternalNpmPlugin) + .enablePlugins(ScalablyTypedConverterGenSourcePlugin) .settings( - // how to setup ScalablyTyped https://youtu.be/hWUAVrNj65c?t=1397 - externalNpm := {println(s"baseDirectory: ${baseDirectory.value}"); file(s"${baseDirectory.value}/../../sigma-js") }, stIgnore ++= List("bouncycastle-js"), + stOutputPackage := "sigmastate", scalaJSLinkerConfig ~= { conf => conf.withSourceMap(false) }, Compile / npmDependencies ++= Seq( - "sigmajs-crypto-facade" -> sigmajsCryptoFacadeVersion + "sigmajs-crypto-facade" -> sigmajsCryptoFacadeVersion, + "@fleet-sdk/common" -> "0.1.0-alpha.14" ) ) diff --git a/project/build.properties b/project/build.properties index c8fcab543a..72413de151 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.6.2 +sbt.version=1.8.3 diff --git a/project/plugins.sbt b/project/plugins.sbt index bf82a32cbb..36996b356c 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -3,8 +3,8 @@ logLevel := Level.Warn addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.9") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0") addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.9.2") -addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1") -addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.7") +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.8") +addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.3.8") addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.17") addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1") addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1") @@ -12,4 +12,4 @@ addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.11.0") addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0") -addSbtPlugin("org.scalablytyped.converter" % "sbt-converter" % "1.0.0-beta37") \ No newline at end of file +addSbtPlugin("org.scalablytyped.converter" % "sbt-converter" % "1.0.0-beta42") \ No newline at end of file diff --git a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Isos.scala b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Isos.scala index 8c1a85902c..3f2dcd03f4 100644 --- a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Isos.scala +++ b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Isos.scala @@ -13,18 +13,18 @@ import sigmastate.{AvlTreeData, AvlTreeFlags, SType} import sigmastate.Values.{Constant, GroupElementConstant} import sigmastate.eval.Extensions.ArrayOps import sigmastate.eval.{CAvlTree, CBigInt, CHeader, CPreHeader, Colls, Digest32Coll, Evaluation} +import sigmastate.fleetSdkCommon.{distEsmTypesBoxesMod => boxesMod, distEsmTypesCommonMod => commonMod, distEsmTypesContextExtensionMod => contextExtensionMod, distEsmTypesInputsMod => inputsMod, distEsmTypesRegistersMod => registersMod, distEsmTypesTokenMod => tokenMod} import sigmastate.interpreter.ContextExtension import sigmastate.serialization.{ErgoTreeSerializer, ValueSerializer} import special.collection.Coll import special.collection.Extensions.CollBytesOps import special.sigma import special.sigma.GroupElement -import typings.fleetSdkCommon.boxesMod.Box -import typings.fleetSdkCommon.commonMod.HexString -import typings.fleetSdkCommon.registersMod.NonMandatoryRegisters -import typings.fleetSdkCommon.tokenMod.TokenAmount -import typings.fleetSdkCommon.{boxesMod, commonMod, contextExtensionMod, inputsMod, registersMod, tokenMod} -import typings.fleetSdkCommon.transactionsMod.UnsignedTransaction +import sigmastate.fleetSdkCommon.distEsmTypesBoxesMod.Box +import sigmastate.fleetSdkCommon.distEsmTypesCommonMod.HexString +import sigmastate.fleetSdkCommon.distEsmTypesRegistersMod.NonMandatoryRegisters +import sigmastate.fleetSdkCommon.distEsmTypesTokenMod.TokenAmount +import sigmastate.fleetSdkCommon.distEsmTypesTransactionsMod.UnsignedTransaction import java.math.BigInteger import scala.collection.immutable.ListMap diff --git a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/SigmaProver.scala b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/SigmaProver.scala index ac3dd72f42..142b7d7588 100644 --- a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/SigmaProver.scala +++ b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/SigmaProver.scala @@ -1,8 +1,8 @@ package org.ergoplatform.sdk.js import org.ergoplatform.sdk -import typings.fleetSdkCommon.boxesMod.Box -import typings.fleetSdkCommon.{commonMod, inputsMod, tokenMod, transactionsMod} +import sigmastate.fleetSdkCommon.distEsmTypesBoxesMod.Box +import sigmastate.fleetSdkCommon.{distEsmTypesCommonMod => commonMod, distEsmTypesInputsMod => inputsMod, distEsmTypesTokenMod => tokenMod, distEsmTypesTransactionsMod => transactionsMod} import scala.scalajs.js import scala.scalajs.js.annotation.JSExportTopLevel From b458142026fe7e6fe36cd8cc2363219749b5db22 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Mon, 26 Jun 2023 21:26:05 +0200 Subject: [PATCH 18/58] compiler-js: upgrade Scala version used in CI --- .github/workflows/ci.yml | 2 +- CONTRIBUTING.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5de0781332..700ed086ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - scala: [2.13.8, 2.12.10, 2.11.12] + scala: [2.13.10, 2.12.10, 2.11.12] java: [adopt@1.8] runs-on: ${{ matrix.os }} steps: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ebb1f7d1dd..ec8a70bf28 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,7 +22,7 @@ By default SBT uses Scala 2.12 for compilation and running tests. To compile for ```shell $ sbt -sbt:sigma-state> ++2.13.8 +sbt:sigma-state> ++2.13.10 sbt:sigma-state> compile sbt:sigma-state> test ``` From 12bb04c1dd66c72a1c43db4f22b139c778fcea16 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Mon, 26 Jun 2023 22:06:48 +0200 Subject: [PATCH 19/58] compiler-js: upgrade Scala version used in CI (2) --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 700ed086ce..2d4e56f263 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - scala: [2.13.10, 2.12.10, 2.11.12] + scala: [2.13.10, 2.12.15, 2.11.12] java: [adopt@1.8] runs-on: ${{ matrix.os }} steps: @@ -74,7 +74,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - scala: [2.12.10] + scala: [2.13.10] java: [adopt@1.8] node-version: [16.x] runs-on: ${{ matrix.os }} From b1b21632cc09aa75ece014f529e01820be98047e Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Thu, 29 Jun 2023 16:58:27 +0200 Subject: [PATCH 20/58] compiler-js: update scrypto deps and Sbt version --- build.sbt | 4 ++-- project/build.properties | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index ec9c23bd52..64c5d87f74 100644 --- a/build.sbt +++ b/build.sbt @@ -82,9 +82,9 @@ ThisBuild / dynverSeparator := "-" val bouncycastleBcprov = "org.bouncycastle" % "bcprov-jdk15on" % "1.66" -val scrypto = "org.scorexfoundation" %% "scrypto" % "2.3.0-1-72a841a6-SNAPSHOT" +val scrypto = "org.scorexfoundation" %% "scrypto" % "2.3.0-2-fffbde1c-SNAPSHOT" val scryptoDependency = - libraryDependencies += "org.scorexfoundation" %%% "scrypto" % "2.3.0-1-72a841a6-SNAPSHOT" + libraryDependencies += "org.scorexfoundation" %%% "scrypto" % "2.3.0-2-fffbde1c-SNAPSHOT" val scorexUtil = "org.scorexfoundation" %% "scorex-util" % "0.2.0" val scorexUtilDependency = diff --git a/project/build.properties b/project/build.properties index 72413de151..46e43a97ed 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.8.3 +sbt.version=1.8.2 From ca5ce26c967a6f8abffff1550b8f975ede21b24b Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Thu, 29 Jun 2023 17:13:10 +0200 Subject: [PATCH 21/58] compiler-js: update sbt version, turn off coverage, run more js tests in CI --- .github/workflows/ci.yml | 14 +++++++------- project/build.properties | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d4e56f263..c0d7dfbd26 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,18 +47,18 @@ jobs: ~/Library/Caches/Coursier/v1 key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} - - name: Runs tests and collect coverage - run: sbt -jvm-opts ci/ci.jvmopts ++${{ matrix.scala }} coverage test coverageReport coverageAggregate + - name: Runs tests + run: sbt -jvm-opts ci/ci.jvmopts ++${{ matrix.scala }} test # - name: Upload coverage report # run: sbt ++${{ matrix.scala }} coverageReport coverageAggregate coveralls # env: # COVERALLS_REPO_TOKEN: $${{ secrets.COVERALLS_REPO_TOKEN }} - - name: Upload coverage report to Codecov - uses: codecov/codecov-action@v1 - with: - fail_ci_if_error: false +# - name: Upload coverage report to Codecov +# uses: codecov/codecov-action@v1 +# with: +# fail_ci_if_error: false - name: Publish a snapshot ${{ github.ref }} if: env.HAS_SECRETS == 'true' @@ -110,7 +110,7 @@ jobs: key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} - name: Runs tests and collect coverage - run: sbt -jvm-opts ci/ci.jvmopts ++${{ matrix.scala }} commonJS/test corelibJS/test interpreterJS/test + run: sbt -jvm-opts ci/ci.jvmopts ++${{ matrix.scala }} commonJS/test corelibJS/test interpreterJS/test graphirJS/test sdkJS/test - name: Publish a snapshot ${{ github.ref }} if: env.HAS_SECRETS == 'true' diff --git a/project/build.properties b/project/build.properties index 46e43a97ed..72413de151 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.8.2 +sbt.version=1.8.3 From fa0841c80affd3b122e29f2b8f237140d00e4445 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Fri, 30 Jun 2023 13:28:12 +0200 Subject: [PATCH 22/58] compiler-js: update js deps --- sigma-js/package.json | 6 +++--- sigma-js/tests/js/bindings.spec.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sigma-js/package.json b/sigma-js/package.json index 530117a8ba..6321673ac2 100644 --- a/sigma-js/package.json +++ b/sigma-js/package.json @@ -23,7 +23,7 @@ "bugs": { "url": "https://github.com/ScorexFoundation/sigmastate-interpreter/issues" }, - "homepage": "https://github.com/ScorexFoundation/sigmastate-interpreter/blob/v5.x-scala-js/sigma-js/README.md", + "homepage": "https://github.com/ScorexFoundation/sigmastate-interpreter/blob/master/sigma-js/README.md", "scripts": { "test": "node_modules/.bin/jest", "clean": "shx rm -rf ./dist/*", @@ -31,9 +31,9 @@ "prepublishOnly": "npm run clean && npm run copy-output" }, "dependencies": { + "@noble/hashes": "1.1.4", "@fleet-sdk/common": "0.1.0-alpha.14", - "bouncycastle-js": "0.1.8", - "sigmajs-crypto-facade": "0.0.3" + "sigmajs-crypto-facade": "0.0.6" }, "devDependencies": { "jest": "^29.0.3", diff --git a/sigma-js/tests/js/bindings.spec.js b/sigma-js/tests/js/bindings.spec.js index b2ea24fee0..2faa48a9fd 100644 --- a/sigma-js/tests/js/bindings.spec.js +++ b/sigma-js/tests/js/bindings.spec.js @@ -1,6 +1,6 @@ const { Types, Values, ErgoTree, ErgoTrees -} = require("../../../sdk/js/target/scala-2.12/sdk-fastopt/main.js"); +} = require("../../../sdk/js/target/scala-2.13/sdk-fastopt/main.js"); describe("Smoke tests for API exporting", () => { it("Should export ErgoTree object", () => { From 1cc06bc7ab07be734b87a5707b279176a121e5f3 Mon Sep 17 00:00:00 2001 From: anon-br Date: Fri, 30 Jun 2023 12:36:19 -0300 Subject: [PATCH 23/58] sigma-js: fix `prepublishOnly` script --- sigma-js/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sigma-js/package.json b/sigma-js/package.json index 6321673ac2..c7c2893348 100644 --- a/sigma-js/package.json +++ b/sigma-js/package.json @@ -27,7 +27,7 @@ "scripts": { "test": "node_modules/.bin/jest", "clean": "shx rm -rf ./dist/*", - "copy-output": "shx mkdir -p ./dist/ && cp -r ../sdk/js/target/scala-2.12/sdk-fastopt/* ./dist/", + "copy-output": "shx mkdir -p ./dist/ && cp -r ../sdk/js/target/scala-2.13/sdk-fastopt/* ./dist/", "prepublishOnly": "npm run clean && npm run copy-output" }, "dependencies": { From dbda9838a9eee4b714bf053bfdcb07360a551e28 Mon Sep 17 00:00:00 2001 From: anon-br Date: Fri, 30 Jun 2023 12:37:03 -0300 Subject: [PATCH 24/58] sigma-js: map js output file as node module --- sigma-js/jest.config.js | 9 +++++++++ sigma-js/tests/js/bindings.spec.js | 4 +--- 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 sigma-js/jest.config.js diff --git a/sigma-js/jest.config.js b/sigma-js/jest.config.js new file mode 100644 index 0000000000..0b160a8376 --- /dev/null +++ b/sigma-js/jest.config.js @@ -0,0 +1,9 @@ +/** @type {import("jest").Config} */ +const config = { + moduleDirectories: ["/node_modules"], + moduleNameMapper: { + "sigmastate-js": "/../sdk/js/target/scala-2.13/sdk-fastopt/main.js", + }, +}; + +module.exports = config; diff --git a/sigma-js/tests/js/bindings.spec.js b/sigma-js/tests/js/bindings.spec.js index 2faa48a9fd..21fd1388ea 100644 --- a/sigma-js/tests/js/bindings.spec.js +++ b/sigma-js/tests/js/bindings.spec.js @@ -1,6 +1,4 @@ -const { - Types, Values, ErgoTree, ErgoTrees -} = require("../../../sdk/js/target/scala-2.13/sdk-fastopt/main.js"); +const { Types, Values, ErgoTree, ErgoTrees } = require("sigmastate-js"); describe("Smoke tests for API exporting", () => { it("Should export ErgoTree object", () => { From 4c59725cbe9bfbab2dde27c68154c139c8cdf048 Mon Sep 17 00:00:00 2001 From: anon-br Date: Fri, 30 Jun 2023 12:43:45 -0300 Subject: [PATCH 25/58] sigma-js: clean up --- sigma-js/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sigma-js/package.json b/sigma-js/package.json index c7c2893348..e70a0b26db 100644 --- a/sigma-js/package.json +++ b/sigma-js/package.json @@ -25,7 +25,7 @@ }, "homepage": "https://github.com/ScorexFoundation/sigmastate-interpreter/blob/master/sigma-js/README.md", "scripts": { - "test": "node_modules/.bin/jest", + "test": "jest", "clean": "shx rm -rf ./dist/*", "copy-output": "shx mkdir -p ./dist/ && cp -r ../sdk/js/target/scala-2.13/sdk-fastopt/* ./dist/", "prepublishOnly": "npm run clean && npm run copy-output" From 7004c12aaad9eae54134191e5fee1843389e1f34 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Sat, 1 Jul 2023 12:46:00 +0200 Subject: [PATCH 26/58] compiler-js: update lib versions --- .github/workflows/ci.yml | 4 ++-- CONTRIBUTING.md | 2 +- build.sbt | 12 ++++++------ project/build.properties | 2 +- project/plugins.sbt | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c0d7dfbd26..f2b6b22f3d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - scala: [2.13.10, 2.12.15, 2.11.12] + scala: [2.13.11, 2.12.18, 2.11.12] java: [adopt@1.8] runs-on: ${{ matrix.os }} steps: @@ -74,7 +74,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - scala: [2.13.10] + scala: [2.13.11] java: [adopt@1.8] node-version: [16.x] runs-on: ${{ matrix.os }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ec8a70bf28..d39447e5db 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,7 +22,7 @@ By default SBT uses Scala 2.12 for compilation and running tests. To compile for ```shell $ sbt -sbt:sigma-state> ++2.13.10 +sbt:sigma-state> ++2.13.11 sbt:sigma-state> compile sbt:sigma-state> test ``` diff --git a/build.sbt b/build.sbt index 64c5d87f74..678a7e76ee 100644 --- a/build.sbt +++ b/build.sbt @@ -6,8 +6,8 @@ organization := "org.scorexfoundation" name := "sigma-state" -lazy val scala213 = "2.13.10" -lazy val scala212 = "2.12.15" +lazy val scala213 = "2.13.11" +lazy val scala212 = "2.12.18" lazy val scala211 = "2.11.12" lazy val allConfigDependency = "compile->compile;test->test" @@ -82,13 +82,13 @@ ThisBuild / dynverSeparator := "-" val bouncycastleBcprov = "org.bouncycastle" % "bcprov-jdk15on" % "1.66" -val scrypto = "org.scorexfoundation" %% "scrypto" % "2.3.0-2-fffbde1c-SNAPSHOT" +val scrypto = "org.scorexfoundation" %% "scrypto" % "2.3.0-3-6c1cc2fe-SNAPSHOT" val scryptoDependency = - libraryDependencies += "org.scorexfoundation" %%% "scrypto" % "2.3.0-2-fffbde1c-SNAPSHOT" + libraryDependencies += "org.scorexfoundation" %%% "scrypto" % "2.3.0-3-6c1cc2fe-SNAPSHOT" -val scorexUtil = "org.scorexfoundation" %% "scorex-util" % "0.2.0" +val scorexUtil = "org.scorexfoundation" %% "scorex-util" % "0.2.0-2-d2b192dc-SNAPSHOT" val scorexUtilDependency = - libraryDependencies += "org.scorexfoundation" %%% "scorex-util" % "0.2.0" + libraryDependencies += "org.scorexfoundation" %%% "scorex-util" % "0.2.0-2-d2b192dc-SNAPSHOT" val debox = "org.scorexfoundation" %% "debox" % "0.10.0" val spireMacros = "org.typelevel" %% "spire-macros" % "0.17.0-M1" diff --git a/project/build.properties b/project/build.properties index 72413de151..3c0b78a7c6 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.8.3 +sbt.version=1.9.1 diff --git a/project/plugins.sbt b/project/plugins.sbt index 36996b356c..f6275f824c 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -9,7 +9,7 @@ addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.17") addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1") addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1") -addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.11.0") -addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0") +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.1") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.2") +addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.21.1") addSbtPlugin("org.scalablytyped.converter" % "sbt-converter" % "1.0.0-beta42") \ No newline at end of file From 7132e35be9a9a55268f204f235dcdc93f98d9051 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Sat, 1 Jul 2023 13:06:03 +0200 Subject: [PATCH 27/58] compiler-js: fix DeserializationResilience --- .../sigmastate/serialization/DeserializationResilience.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sc/shared/src/test/scala/sigmastate/serialization/DeserializationResilience.scala b/sc/shared/src/test/scala/sigmastate/serialization/DeserializationResilience.scala index ebc802c441..0ebfbd16df 100644 --- a/sc/shared/src/test/scala/sigmastate/serialization/DeserializationResilience.scala +++ b/sc/shared/src/test/scala/sigmastate/serialization/DeserializationResilience.scala @@ -386,7 +386,7 @@ class DeserializationResilience extends DeserializationResilienceTesting { property("test assumptions of how negative value from getUInt().toInt is handled") { assertExceptionThrown( safeNewArray[Int](-1), - exceptionLike[RuntimeException]()) // NegativeArraySizeException for JVM and JavaScriptException for Scala.js + rootCauseLike[NegativeArraySizeException]()) val bytes = writeUInt(10) val store = new ConstantStore(IndexedSeq(IntConstant(1))) @@ -398,7 +398,7 @@ class DeserializationResilience extends DeserializationResilienceTesting { assertExceptionThrown( r.getBytes(-1), - exceptionLike[RuntimeException]()) // NegativeArraySizeException for JVM and JavaScriptException for Scala.js + rootCauseLike[NegativeArraySizeException]()) r.valDefTypeStore(-1) = SInt // no exception on negative key From 1ac06c8014ca7f75388039934970d3ef0a370700 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Sat, 1 Jul 2023 18:02:21 +0200 Subject: [PATCH 28/58] compiler-js: xxxObj suffix for companions + added SigmaCompiler + js test --- build.sbt | 91 ++++++++++--------- .../sigmastate/lang/js/SigmaCompiler.scala | 48 ++++++++++ .../org/ergoplatform/sdk/js/ErgoTree.scala | 2 +- .../org/ergoplatform/sdk/js/SigmaProver.scala | 2 +- .../scala/org/ergoplatform/sdk/js/Type.scala | 2 +- .../scala/org/ergoplatform/sdk/js/Value.scala | 2 +- sigma-js/jest.config.js | 2 +- sigma-js/package.json | 2 +- sigma-js/tests/js/sc.spec.js | 9 ++ .../js/{bindings.spec.js => sdk.spec.js} | 52 +++++------ 10 files changed, 135 insertions(+), 77 deletions(-) create mode 100644 sc/js/src/main/scala/sigmastate/lang/js/SigmaCompiler.scala create mode 100644 sigma-js/tests/js/sc.spec.js rename sigma-js/tests/js/{bindings.spec.js => sdk.spec.js} (61%) diff --git a/build.sbt b/build.sbt index 678a7e76ee..de7c708e56 100644 --- a/build.sbt +++ b/build.sbt @@ -276,7 +276,6 @@ lazy val interpreterJS = interpreter.js .enablePlugins(ScalaJSBundlerPlugin) .enablePlugins(ScalablyTypedConverterGenSourcePlugin) .settings( - stIgnore ++= List("bouncycastle-js"), stOutputPackage := "sigmastate", scalaJSLinkerConfig ~= { conf => conf.withSourceMap(false) @@ -318,50 +317,6 @@ lazy val parsersJS = parsers.js ) ) -lazy val sc = crossProject(JVMPlatform, JSPlatform) - .in(file("sc")) - .dependsOn( - graphir % allConfigDependency, - interpreter % allConfigDependency, - parsers % allConfigDependency - ) - .settings( - commonSettings ++ testSettings2, - commonDependenies2, - testingDependencies2, - scorexUtilDependency, fastparseDependency, circeDependency, - Test / parallelExecution := false - ) - .settings(publish / skip := true) - .jvmSettings( - crossScalaSettings, - libraryDependencies ++= Seq(scalameter) - ) - .jsSettings( - crossScalaSettingsJS, - libraryDependencies ++= Seq( - "org.scala-js" %%% "scala-js-macrotask-executor" % "1.0.0" - ), - useYarn := true - ) -lazy val scJS = sc.js - .enablePlugins(ScalaJSBundlerPlugin) - .settings( - scalaJSLinkerConfig ~= { conf => - conf.withSourceMap(false) - .withModuleKind(ModuleKind.CommonJSModule) - .withSemantics(sem => - // compliance with JVM semantics is required for tests to pass on JS - // we sacrifice some optimizations (and performance) for that - sem.withAsInstanceOfs(CheckedBehavior.Compliant) - .withArrayIndexOutOfBounds(CheckedBehavior.Compliant) - ) - }, - Compile / npmDependencies ++= Seq( - "sigmajs-crypto-facade" -> sigmajsCryptoFacadeVersion - ) - ) - lazy val sdk = crossProject(JVMPlatform, JSPlatform) .in(file("sdk")) .dependsOn(corelib % allConfigDependency, interpreter % allConfigDependency, parsers % allConfigDependency) @@ -393,6 +348,52 @@ lazy val sdkJS = sdk.js ) ) +lazy val sc = crossProject(JVMPlatform, JSPlatform) + .in(file("sc")) + .dependsOn( + graphir % allConfigDependency, + interpreter % allConfigDependency, + parsers % allConfigDependency, + sdk % allConfigDependency + ) + .settings( + commonSettings ++ testSettings2, + commonDependenies2, + testingDependencies2, + scorexUtilDependency, fastparseDependency, circeDependency, + Test / parallelExecution := false + ) + .settings(publish / skip := true) + .jvmSettings( + crossScalaSettings, + libraryDependencies ++= Seq(scalameter) + ) + .jsSettings( + crossScalaSettingsJS, + libraryDependencies ++= Seq( + "org.scala-js" %%% "scala-js-macrotask-executor" % "1.0.0" + ), + useYarn := true + ) +lazy val scJS = sc.js + .enablePlugins(ScalaJSBundlerPlugin) + .settings( + scalaJSLinkerConfig ~= { conf => + conf.withSourceMap(false) + .withModuleKind(ModuleKind.CommonJSModule) + .withSemantics(sem => + // compliance with JVM semantics is required for tests to pass on JS + // we sacrifice some optimizations (and performance) for that + sem.withAsInstanceOfs(CheckedBehavior.Compliant) + .withArrayIndexOutOfBounds(CheckedBehavior.Compliant) + ) + }, + Compile / npmDependencies ++= Seq( + "sigmajs-crypto-facade" -> sigmajsCryptoFacadeVersion + ) + ) + + lazy val sigma = (project in file(".")) .aggregate(common.jvm, corelib.jvm, graphir.jvm, interpreter.jvm, parsers.jvm, sc.jvm, sdk.jvm) .settings(libraryDefSettings, rootSettings) diff --git a/sc/js/src/main/scala/sigmastate/lang/js/SigmaCompiler.scala b/sc/js/src/main/scala/sigmastate/lang/js/SigmaCompiler.scala new file mode 100644 index 0000000000..47685d761b --- /dev/null +++ b/sc/js/src/main/scala/sigmastate/lang/js/SigmaCompiler.scala @@ -0,0 +1,48 @@ +package sigmastate.lang.js + +import org.ergoplatform.ErgoAddressEncoder +import org.ergoplatform.sdk.js.Isos.isoValueToConstant +import org.scalablytyped.runtime.StringDictionary + +import scala.scalajs.js +import scala.scalajs.js.annotation.JSExportTopLevel +import org.ergoplatform.sdk.js.{ErgoTree, Value} +import sigmastate.Values +import sigmastate.eval.CompiletimeIRContext +import sigmastate.lang.Terms.ValueOps + + +@JSExportTopLevel("SigmaCompiler") +class SigmaCompiler(_compiler: sigmastate.lang.SigmaCompiler) extends js.Object { + + def compile( + namedConstants: StringDictionary[Value], + segregateConstants: Boolean, + additionalHeaderFlags: Byte, ergoScript: String): ErgoTree = { + val env = StringDictionary + .wrapStringDictionary(namedConstants) + .view.mapValues(v => isoValueToConstant.to(v)).toMap + val IR = new CompiletimeIRContext + val prop = _compiler.compile(env, ergoScript)(IR).buildTree + require(prop.tpe.isSigmaProp, s"Expected SigmaProp expression type bue got ${prop.tpe}: $prop") + + val tree = if (segregateConstants) { + Values.ErgoTree.withSegregation(additionalHeaderFlags, prop.asSigmaProp) + } else { + Values.ErgoTree.withoutSegregation(additionalHeaderFlags, prop.asSigmaProp) + } + new ErgoTree(tree) + } +} + +@JSExportTopLevel("SigmaCompilerObj") +object SigmaCompiler extends js.Object { + def forMainnet(): SigmaCompiler = create(ErgoAddressEncoder.MainnetNetworkPrefix) + + def forTestnet(): SigmaCompiler = create(ErgoAddressEncoder.TestnetNetworkPrefix) + + def create(networkPrefix: Byte): SigmaCompiler = { + val compiler = new sigmastate.lang.SigmaCompiler(networkPrefix) + new SigmaCompiler(compiler) + } +} diff --git a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/ErgoTree.scala b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/ErgoTree.scala index 0fbacabc95..8f48ce6ebb 100644 --- a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/ErgoTree.scala +++ b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/ErgoTree.scala @@ -23,7 +23,7 @@ class ErgoTree(tree: Values.ErgoTree) extends js.Object { } /** An exported JavaScript object providing utility methods for working with ErgoTree instances. */ -@JSExportTopLevel("ErgoTrees") +@JSExportTopLevel("ErgoTreeObj") object ErgoTree extends js.Object { /** Deserializes an ErgoTree instance from a hexadecimal string. diff --git a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/SigmaProver.scala b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/SigmaProver.scala index 142b7d7588..41bf634473 100644 --- a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/SigmaProver.scala +++ b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/SigmaProver.scala @@ -53,6 +53,6 @@ class SigmaProver(_prover: sdk.SigmaProver) extends js.Object { class ReducedTransaction //TODO finish implementation -@JSExportTopLevel("ProverFactory") +@JSExportTopLevel("SigmaProverObj") object SigmaProver { } diff --git a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Type.scala b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Type.scala index 61f4252e37..51cea3f57b 100644 --- a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Type.scala +++ b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Type.scala @@ -17,7 +17,7 @@ class Type(private[js] final val rtype: RType[_]) extends js.Object { override def toString = s"Type($rtype)" } -@JSExportTopLevel("Types") +@JSExportTopLevel("TypeObj") object Type extends js.Object { /** Descriptor of ErgoScript type Byte. */ val Byte = new Type(RType.ByteType) diff --git a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala index 318e3b08ee..3d570e118d 100644 --- a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala +++ b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala @@ -64,7 +64,7 @@ class Value(val data: Any, val tpe: Type) extends js.Object { } } -@JSExportTopLevel("Values") +@JSExportTopLevel("ValueObj") object Value extends js.Object { /** Maximal positive value of ES type Long */ val MaxLong = js.BigInt("0x7fffffffffffffff") diff --git a/sigma-js/jest.config.js b/sigma-js/jest.config.js index 0b160a8376..34dbc9a68c 100644 --- a/sigma-js/jest.config.js +++ b/sigma-js/jest.config.js @@ -2,7 +2,7 @@ const config = { moduleDirectories: ["/node_modules"], moduleNameMapper: { - "sigmastate-js": "/../sdk/js/target/scala-2.13/sdk-fastopt/main.js", + "sigmastate-js": "/../sc/js/target/scala-2.13/sc-fastopt/main.js", }, }; diff --git a/sigma-js/package.json b/sigma-js/package.json index e70a0b26db..31ba019ac5 100644 --- a/sigma-js/package.json +++ b/sigma-js/package.json @@ -27,7 +27,7 @@ "scripts": { "test": "jest", "clean": "shx rm -rf ./dist/*", - "copy-output": "shx mkdir -p ./dist/ && cp -r ../sdk/js/target/scala-2.13/sdk-fastopt/* ./dist/", + "copy-output": "shx mkdir -p ./dist/ && cp -r ../sc/js/target/scala-2.13/sc-fastopt/* ./dist/", "prepublishOnly": "npm run clean && npm run copy-output" }, "dependencies": { diff --git a/sigma-js/tests/js/sc.spec.js b/sigma-js/tests/js/sc.spec.js new file mode 100644 index 0000000000..74d88d0d3d --- /dev/null +++ b/sigma-js/tests/js/sc.spec.js @@ -0,0 +1,9 @@ +const { Types, Values, ErgoTree, SigmaCompiler, SigmaCompilerObj } = require("sigmastate-js"); + +describe("Smoke tests for API exporting", () => { + it("Should create SigmaCompiler", () => { + let compiler = SigmaCompilerObj.create(0); + expect(compiler).not.toBeUndefined(); + }); +}); + diff --git a/sigma-js/tests/js/bindings.spec.js b/sigma-js/tests/js/sdk.spec.js similarity index 61% rename from sigma-js/tests/js/bindings.spec.js rename to sigma-js/tests/js/sdk.spec.js index 21fd1388ea..6805e6165b 100644 --- a/sigma-js/tests/js/bindings.spec.js +++ b/sigma-js/tests/js/sdk.spec.js @@ -1,4 +1,4 @@ -const { Types, Values, ErgoTree, ErgoTrees } = require("sigmastate-js"); +const { TypeObj, ValueObj, ErgoTree, ErgoTreeObj } = require("sigmastate-js"); describe("Smoke tests for API exporting", () => { it("Should export ErgoTree object", () => { @@ -9,7 +9,7 @@ describe("Smoke tests for API exporting", () => { describe("Smoke tests for ErgoTree", () => { it("Should create fromHex", () => { var hex = "100604000e000400040005000500d803d601e30004d602e4c6a70408d603e4c6a7050595e67201d804d604b2a5e4720100d605b2db63087204730000d606db6308a7d60799c1a7c17204d1968302019683050193c27204c2a7938c720501730193e4c672040408720293e4c672040505720393e4c67204060ec5a796830201929c998c7205029591b1720673028cb272067303000273047203720792720773057202"; - var tree = ErgoTrees.fromHex(hex) + var tree = ErgoTreeObj.fromHex(hex) expect(tree.toString()).not.toBeUndefined(); expect(tree.toHex()).toEqual(hex) }); @@ -17,15 +17,15 @@ describe("Smoke tests for ErgoTree", () => { describe("Smoke tests for Types", () => { it("Should create primitive types", () => { - expect(Types.Byte.name).toEqual("Byte"); - expect(Types.Short.name).toEqual("Short"); - expect(Types.Int.name).toEqual("Int"); - expect(Types.Long.name).toEqual("Long"); + expect(TypeObj.Byte.name).toEqual("Byte"); + expect(TypeObj.Short.name).toEqual("Short"); + expect(TypeObj.Int.name).toEqual("Int"); + expect(TypeObj.Long.name).toEqual("Long"); }); it("Should create complex types", () => { - expect(Types.pairType(Types.Int, Types.Long).name).toEqual("(Int, Long)"); - expect(Types.collType(Types.Int).name).toEqual("Coll[Int]"); - expect(Types.collType(Types.pairType(Types.Int, Types.Long)).name) + expect(TypeObj.pairType(TypeObj.Int, TypeObj.Long).name).toEqual("(Int, Long)"); + expect(TypeObj.collType(TypeObj.Int).name).toEqual("Coll[Int]"); + expect(TypeObj.collType(TypeObj.pairType(TypeObj.Int, TypeObj.Long)).name) .toEqual("Coll[(Int, Long)]"); }); }); @@ -40,20 +40,20 @@ function testRange(factory, min, max) { describe("Smoke tests for Values", () => { it("Should create values of primitive types", () => { - expect(Values.ofByte(0).data).toEqual(0); - expect(Values.ofByte(0).tpe).toEqual(Types.Byte); - testRange(function(v) { return Values.ofByte(v); }, -128, 127); - testRange(function(v) { return Values.ofShort(v); }, -32768, 32767); - testRange(function(v) { return Values.ofInt(v); }, -0x7FFFFFFF - 1, 0x7FFFFFFF); - testRange(function(v) { return Values.ofLong(v); }, -0x8000000000000000n, 0x7fffffffffffffffn); + expect(ValueObj.ofByte(0).data).toEqual(0); + expect(ValueObj.ofByte(0).tpe).toEqual(TypeObj.Byte); + testRange(function(v) { return ValueObj.ofByte(v); }, -128, 127); + testRange(function(v) { return ValueObj.ofShort(v); }, -32768, 32767); + testRange(function(v) { return ValueObj.ofInt(v); }, -0x7FFFFFFF - 1, 0x7FFFFFFF); + testRange(function(v) { return ValueObj.ofLong(v); }, -0x8000000000000000n, 0x7fffffffffffffffn); }); it("Should create values of complex types", () => { - let pair = Values.pairOf(Values.ofByte(10), Values.ofLong(20n)); + let pair = ValueObj.pairOf(ValueObj.ofByte(10), ValueObj.ofLong(20n)); expect(pair.data).toEqual([10, 20n]); expect(pair.tpe.name).toEqual("(Byte, Long)"); - let coll = Values.collOf([-10, 0, 10], Types.Byte) + let coll = ValueObj.collOf([-10, 0, 10], TypeObj.Byte) expect(coll.tpe.name).toEqual("Coll[Byte]"); }); @@ -62,41 +62,41 @@ describe("Smoke tests for Values", () => { let pairHex = "3e050a28" it("Long Value.toHex", () => { - let v = Values.ofLong(1200n) + let v = ValueObj.ofLong(1200n) expect(v.toHex()).toEqual(longHex) }); it("Coll Value.toHex", () => { let arr = [ [1, 2, 3], [10, 20] ] - let t = Types.collType(Types.Byte) - let collV = Values.collOf(arr, t) + let t = TypeObj.collType(TypeObj.Byte) + let collV = ValueObj.collOf(arr, t) expect(collV.tpe.name).toEqual("Coll[Coll[Byte]]"); expect(collV.toHex()).toEqual(collHex) }); it("Pair Value.toHex", () => { - let fst = Values.ofByte(10) - let snd = Values.ofLong(20) - let pair = Values.pairOf(fst, snd) + let fst = ValueObj.ofByte(10) + let snd = ValueObj.ofLong(20) + let pair = ValueObj.pairOf(fst, snd) expect(pair.tpe.name).toEqual("(Byte, Long)"); expect(pair.toHex()).toEqual(pairHex) }); it("Long Value.fromHex", () => { - let v = Values.fromHex(longHex) + let v = ValueObj.fromHex(longHex) expect(v.data).toEqual(1200n) expect(v.tpe.name).toEqual("Long") }); it("Coll Value.fromHex", () => { - let coll = Values.fromHex(collHex) + let coll = ValueObj.fromHex(collHex) expect(coll.tpe.name).toEqual("Coll[Coll[Byte]]"); expect(coll.toHex()).toEqual(collHex) }); it("Pair Value.fromHex", () => { - let p = Values.fromHex(pairHex) + let p = ValueObj.fromHex(pairHex) expect(p.tpe.name).toEqual("(Byte, Long)"); expect(p.toHex()).toEqual(pairHex) }); From 7a1dfc032a6fcb02bb619e353a0483ca4da41e9f Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Sat, 1 Jul 2023 18:35:12 +0200 Subject: [PATCH 29/58] compiler-js: tests for js.SigmaCompiler, bump Sigma.js version 0.1.0 --- .../scala/sigmastate/lang/js/SigmaCompiler.scala | 2 +- .../main/scala/org/ergoplatform/sdk/js/Isos.scala | 2 +- sigma-js/package.json | 2 +- sigma-js/tests/js/sc.spec.js | 12 +++++++++++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/sc/js/src/main/scala/sigmastate/lang/js/SigmaCompiler.scala b/sc/js/src/main/scala/sigmastate/lang/js/SigmaCompiler.scala index 47685d761b..c915b3ee7d 100644 --- a/sc/js/src/main/scala/sigmastate/lang/js/SigmaCompiler.scala +++ b/sc/js/src/main/scala/sigmastate/lang/js/SigmaCompiler.scala @@ -41,7 +41,7 @@ object SigmaCompiler extends js.Object { def forTestnet(): SigmaCompiler = create(ErgoAddressEncoder.TestnetNetworkPrefix) - def create(networkPrefix: Byte): SigmaCompiler = { + private def create(networkPrefix: Byte): SigmaCompiler = { val compiler = new sigmastate.lang.SigmaCompiler(networkPrefix) new SigmaCompiler(compiler) } diff --git a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Isos.scala b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Isos.scala index 3f2dcd03f4..9d0bd52bdb 100644 --- a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Isos.scala +++ b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Isos.scala @@ -370,7 +370,7 @@ object Isos { } val isoBox: Iso[Box[commonMod.Amount], ErgoBox] = new Iso[Box[commonMod.Amount], ErgoBox] { - import sigmastate.eval._ +// import sigmastate.eval._ override def to(x: Box[commonMod.Amount]): ErgoBox = { val ergoBox = new ErgoBox( value = isoAmount.to(x.value), diff --git a/sigma-js/package.json b/sigma-js/package.json index 31ba019ac5..b6bb8078f9 100644 --- a/sigma-js/package.json +++ b/sigma-js/package.json @@ -1,6 +1,6 @@ { "name": "sigmastate-js", - "version": "0.0.9", + "version": "0.1.0", "description": "Sigma.js library", "main": "dist/main.js", "files": [ diff --git a/sigma-js/tests/js/sc.spec.js b/sigma-js/tests/js/sc.spec.js index 74d88d0d3d..d3b0a913e9 100644 --- a/sigma-js/tests/js/sc.spec.js +++ b/sigma-js/tests/js/sc.spec.js @@ -1,9 +1,19 @@ const { Types, Values, ErgoTree, SigmaCompiler, SigmaCompilerObj } = require("sigmastate-js"); describe("Smoke tests for API exporting", () => { + let compiler = SigmaCompilerObj.forMainnet(); + it("Should create SigmaCompiler", () => { - let compiler = SigmaCompilerObj.create(0); expect(compiler).not.toBeUndefined(); }); + + it("SigmaCompiler should compile", () => { + let treeWithSegregation = compiler.compile({}, true, 0, "sigmaProp(HEIGHT > 100)"); + expect(treeWithSegregation).not.toBeUndefined(); + expect(treeWithSegregation.toHex()).toEqual("100104c801d191a37300") + + let treeWithoutSegregation = compiler.compile({}, false, 0, "sigmaProp(HEIGHT > 100)"); + expect(treeWithoutSegregation.toHex()).toEqual("00d191a304c801") + }); }); From 04ce57092243ede3647b02d1bb77b0868e0a9069 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Sat, 1 Jul 2023 18:45:14 +0200 Subject: [PATCH 30/58] compiler-js: more sc.spec.js tests --- sigma-js/tests/js/sc.spec.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/sigma-js/tests/js/sc.spec.js b/sigma-js/tests/js/sc.spec.js index d3b0a913e9..eff7ba556f 100644 --- a/sigma-js/tests/js/sc.spec.js +++ b/sigma-js/tests/js/sc.spec.js @@ -1,4 +1,4 @@ -const { Types, Values, ErgoTree, SigmaCompiler, SigmaCompilerObj } = require("sigmastate-js"); +const { TypeObj, ValueObj, ErgoTree, SigmaCompiler, SigmaCompilerObj } = require("sigmastate-js"); describe("Smoke tests for API exporting", () => { let compiler = SigmaCompilerObj.forMainnet(); @@ -7,13 +7,24 @@ describe("Smoke tests for API exporting", () => { expect(compiler).not.toBeUndefined(); }); + let segregatedTreeHex = "100104c801d191a37300"; + let embedddedTreeHex = "00d191a304c801"; + it("SigmaCompiler should compile", () => { let treeWithSegregation = compiler.compile({}, true, 0, "sigmaProp(HEIGHT > 100)"); expect(treeWithSegregation).not.toBeUndefined(); - expect(treeWithSegregation.toHex()).toEqual("100104c801d191a37300") + expect(treeWithSegregation.toHex()).toEqual(segregatedTreeHex) let treeWithoutSegregation = compiler.compile({}, false, 0, "sigmaProp(HEIGHT > 100)"); - expect(treeWithoutSegregation.toHex()).toEqual("00d191a304c801") + expect(treeWithoutSegregation.toHex()).toEqual(embedddedTreeHex) + }); + + it("SigmaCompiler should compile with named constants", () => { + let treeWithSegregation = compiler.compile( + {"deadline": ValueObj.ofInt(100)}, + true, 0, "sigmaProp(HEIGHT > deadline)"); + expect(treeWithSegregation).not.toBeUndefined(); + expect(treeWithSegregation.toHex()).toEqual(segregatedTreeHex) }); }); From 85babc564da52c22d7c13f793a623e4302c037af Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Sat, 1 Jul 2023 19:07:26 +0200 Subject: [PATCH 31/58] compiler-js: README.md --- sigma-js/README.md | 35 +++++++++++++++++++++++++++++++++-- sigma-js/package.json | 2 +- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/sigma-js/README.md b/sigma-js/README.md index 8e598ffe51..aaa6c1aa81 100644 --- a/sigma-js/README.md +++ b/sigma-js/README.md @@ -15,9 +15,40 @@ The modules published here can be used directly from JavaScript. # Getting Started -TODO +Add the following dependency to your `package.json`: + +```json +{ + "dependencies": { + "sigmastate-js": "0.1.1" + } +} +``` +Then run `npm install`. # Examples -TODO +### How to create Sigma type descriptors + +Import `TypeObj` module, then use: +- fields to create simple types (e.g. `TypeObj.Int`) +- method `TypeObj.pairType` (e.g. `TypeObj.pairType(TypeObj.Int, TypeObj.Long)`) +- method `TypeObj.collType` (e.g. `TypeObj.collType(TypeObj.Int)`) + +See examples in tests [sdk.spec.js](tests/js/sdk.spec.js) + +### How to create Sigma values + +Import `ValueObj` module, then use its methods. +See examples in tests [sdk.spec.js](tests/js/sdk.spec.js) + +### How to work with ErgoTree + +Import `ErgoTreeObj` module, and `ErgoTree` class then use its methods. +See examples in tests [sdk.spec.js](tests/js/sdk.spec.js) + +### Compile ErgoScript to ErgoTree + +Import `SigmaCompilerObj` module and `SigmaCompiler` class, then use its methods. +See compiler tests in [sc.spec.js](tests/js/sc.spec.js) diff --git a/sigma-js/package.json b/sigma-js/package.json index b6bb8078f9..46f2d0ce84 100644 --- a/sigma-js/package.json +++ b/sigma-js/package.json @@ -1,6 +1,6 @@ { "name": "sigmastate-js", - "version": "0.1.0", + "version": "0.1.1", "description": "Sigma.js library", "main": "dist/main.js", "files": [ From e90b1f347af284c741d8ae7fd5c50ca5e171862a Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Sat, 1 Jul 2023 19:11:46 +0200 Subject: [PATCH 32/58] compiler-js: README.md fix urls --- sigma-js/README.md | 10 +++++----- sigma-js/package.json | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sigma-js/README.md b/sigma-js/README.md index aaa6c1aa81..9fb4b491b2 100644 --- a/sigma-js/README.md +++ b/sigma-js/README.md @@ -34,21 +34,21 @@ Import `TypeObj` module, then use: - fields to create simple types (e.g. `TypeObj.Int`) - method `TypeObj.pairType` (e.g. `TypeObj.pairType(TypeObj.Int, TypeObj.Long)`) - method `TypeObj.collType` (e.g. `TypeObj.collType(TypeObj.Int)`) - -See examples in tests [sdk.spec.js](tests/js/sdk.spec.js) + [sdk.spec.js](https://github.com/ScorexFoundation/sigmastate-interpreter/ tests/js/sdk.spec.js) +See examples in tests [sdk.spec.js](https://github.com/ScorexFoundation/sigmastate-interpreter/blob/1ac06c8014ca7f75388039934970d3ef0a370700/sigma-js/tests/js/sdk.spec.js) ### How to create Sigma values Import `ValueObj` module, then use its methods. -See examples in tests [sdk.spec.js](tests/js/sdk.spec.js) +See examples in tests [sdk.spec.js](https://github.com/ScorexFoundation/sigmastate-interpreter/blob/1ac06c8014ca7f75388039934970d3ef0a370700/sigma-js/tests/js/sdk.spec.js) ### How to work with ErgoTree Import `ErgoTreeObj` module, and `ErgoTree` class then use its methods. -See examples in tests [sdk.spec.js](tests/js/sdk.spec.js) +See examples in tests [sdk.spec.js](https://github.com/ScorexFoundation/sigmastate-interpreter/blob/1ac06c8014ca7f75388039934970d3ef0a370700/sigma-js/tests/js/sdk.spec.js) ### Compile ErgoScript to ErgoTree Import `SigmaCompilerObj` module and `SigmaCompiler` class, then use its methods. -See compiler tests in [sc.spec.js](tests/js/sc.spec.js) +See compiler tests in [sc.spec.js](https://github.com/ScorexFoundation/sigmastate-interpreter/blob/04ce57092243ede3647b02d1bb77b0868e0a9069/sigma-js/tests/js/sc.spec.js) diff --git a/sigma-js/package.json b/sigma-js/package.json index 46f2d0ce84..7b15d709a8 100644 --- a/sigma-js/package.json +++ b/sigma-js/package.json @@ -1,6 +1,6 @@ { "name": "sigmastate-js", - "version": "0.1.1", + "version": "0.1.2", "description": "Sigma.js library", "main": "dist/main.js", "files": [ From 99cfe60d122f66a37b067b329f564de9f6681f39 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Sat, 1 Jul 2023 19:14:33 +0200 Subject: [PATCH 33/58] compiler-js: cleanup README.md --- sigma-js/README.md | 2 +- sigma-js/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sigma-js/README.md b/sigma-js/README.md index 9fb4b491b2..0092f24e2e 100644 --- a/sigma-js/README.md +++ b/sigma-js/README.md @@ -34,7 +34,7 @@ Import `TypeObj` module, then use: - fields to create simple types (e.g. `TypeObj.Int`) - method `TypeObj.pairType` (e.g. `TypeObj.pairType(TypeObj.Int, TypeObj.Long)`) - method `TypeObj.collType` (e.g. `TypeObj.collType(TypeObj.Int)`) - [sdk.spec.js](https://github.com/ScorexFoundation/sigmastate-interpreter/ tests/js/sdk.spec.js) + See examples in tests [sdk.spec.js](https://github.com/ScorexFoundation/sigmastate-interpreter/blob/1ac06c8014ca7f75388039934970d3ef0a370700/sigma-js/tests/js/sdk.spec.js) ### How to create Sigma values diff --git a/sigma-js/package.json b/sigma-js/package.json index 7b15d709a8..8c395b0ca6 100644 --- a/sigma-js/package.json +++ b/sigma-js/package.json @@ -1,6 +1,6 @@ { "name": "sigmastate-js", - "version": "0.1.2", + "version": "0.1.3", "description": "Sigma.js library", "main": "dist/main.js", "files": [ From 79df4ca171a77233947d835042ce5c82ee520469 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Sun, 2 Jul 2023 17:02:20 +0200 Subject: [PATCH 34/58] compiler-js: added properties to js.ErgoTree --- .../org/ergoplatform/sdk/js/ErgoTree.scala | 26 +++++++++++---- sigma-js/package.json | 2 +- sigma-js/tests/js/ErgoTree.spec.js | 33 +++++++++++++++++++ sigma-js/tests/js/sdk.spec.js | 17 +--------- 4 files changed, 54 insertions(+), 24 deletions(-) create mode 100644 sigma-js/tests/js/ErgoTree.spec.js diff --git a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/ErgoTree.scala b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/ErgoTree.scala index 8f48ce6ebb..672f79e687 100644 --- a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/ErgoTree.scala +++ b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/ErgoTree.scala @@ -5,20 +5,32 @@ import sigmastate.Values import sigmastate.serialization.ErgoTreeSerializer import scala.scalajs.js -import scala.scalajs.js.annotation.{JSExportTopLevel} +import scala.scalajs.js.JSConverters.JSRichIterableOnce +import scala.scalajs.js.annotation.JSExportTopLevel /** An exported JavaScript class wrapping the Scala `Values.ErgoTree` type. */ @JSExportTopLevel("ErgoTree") class ErgoTree(tree: Values.ErgoTree) extends js.Object { + /** The first byte of serialized byte array which determines interpretation of the rest of the array. */ + def header(): Byte = tree.header + + def version(): Byte = tree.version + + def isConstantSegregation(): Boolean = tree.isConstantSegregation + + def hasSize(): Boolean = tree.hasSize + /** Serializes the ErgoTree instance to an array of bytes. */ - def toBytes(): Array[Byte] = { - val bytes = ErgoTreeSerializer.DefaultSerializer.serializeErgoTree(tree) - bytes - } + def bytes(): Array[Byte] = tree.bytes /** Serializes the ErgoTree instance to a hexadecimal string. */ - def toHex(): String = { - Base16.encode(toBytes()) + def toHex(): String = tree.bytesHex + + /** Returns segregated constants of this tree as [[js.Array]]. */ + def constants(): js.Array[Value] = { + val constants = tree.constants + val values = constants.map(Isos.isoValueToConstant.from) + values.toJSArray } } diff --git a/sigma-js/package.json b/sigma-js/package.json index 8c395b0ca6..869c6177ee 100644 --- a/sigma-js/package.json +++ b/sigma-js/package.json @@ -1,6 +1,6 @@ { "name": "sigmastate-js", - "version": "0.1.3", + "version": "0.1.4", "description": "Sigma.js library", "main": "dist/main.js", "files": [ diff --git a/sigma-js/tests/js/ErgoTree.spec.js b/sigma-js/tests/js/ErgoTree.spec.js new file mode 100644 index 0000000000..a0647474ba --- /dev/null +++ b/sigma-js/tests/js/ErgoTree.spec.js @@ -0,0 +1,33 @@ +const { ErgoTree, ErgoTreeObj } = require("sigmastate-js"); + +describe("Smoke tests for API exporting", () => { + it("Should export ErgoTree object", () => { + expect(ErgoTree).not.toBeUndefined(); + }); +}); + +describe("Smoke tests for ErgoTree", () => { + let hex = "100604000e000400040005000500d803d601e30004d602e4c6a70408d603e4c6a7050595e67201d804d604b2a5e4720100d605b2db63087204730000d606db6308a7d60799c1a7c17204d1968302019683050193c27204c2a7938c720501730193e4c672040408720293e4c672040505720393e4c67204060ec5a796830201929c998c7205029591b1720673028cb272067303000273047203720792720773057202"; + + it("Should create fromHex", () => { + let tree = ErgoTreeObj.fromHex(hex); + expect(tree.toString()).not.toBeUndefined(); + expect(tree.toHex()).toEqual(hex) + }); + + it("Has properties", () => { + let tree = ErgoTreeObj.fromHex(hex); + + expect(tree.header()).toEqual(0x10) + expect(tree.version()).toEqual(0) + expect(tree.isConstantSegregation()).toEqual(true) + expect(tree.hasSize()).toEqual(false) + }); + + it("Has constants", () => { + let tree = ErgoTreeObj.fromHex(hex); + let constants = tree.constants().map(c => c.toHex()) + expect(constants).toEqual(["0400", "0e00", "0400", "0400", "0500", "0500"]) + }); +}); + diff --git a/sigma-js/tests/js/sdk.spec.js b/sigma-js/tests/js/sdk.spec.js index 6805e6165b..249dc2eb96 100644 --- a/sigma-js/tests/js/sdk.spec.js +++ b/sigma-js/tests/js/sdk.spec.js @@ -1,19 +1,4 @@ -const { TypeObj, ValueObj, ErgoTree, ErgoTreeObj } = require("sigmastate-js"); - -describe("Smoke tests for API exporting", () => { - it("Should export ErgoTree object", () => { - expect(ErgoTree).not.toBeUndefined(); - }); -}); - -describe("Smoke tests for ErgoTree", () => { - it("Should create fromHex", () => { - var hex = "100604000e000400040005000500d803d601e30004d602e4c6a70408d603e4c6a7050595e67201d804d604b2a5e4720100d605b2db63087204730000d606db6308a7d60799c1a7c17204d1968302019683050193c27204c2a7938c720501730193e4c672040408720293e4c672040505720393e4c67204060ec5a796830201929c998c7205029591b1720673028cb272067303000273047203720792720773057202"; - var tree = ErgoTreeObj.fromHex(hex) - expect(tree.toString()).not.toBeUndefined(); - expect(tree.toHex()).toEqual(hex) - }); -}); +const { TypeObj, ValueObj } = require("sigmastate-js"); describe("Smoke tests for Types", () => { it("Should create primitive types", () => { From 80af306b1b134d4dc9fd2c6f4519a7044b45e75c Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Mon, 3 Jul 2023 19:30:48 +0200 Subject: [PATCH 35/58] compiler-js: fix equality of CErgoLikeStateContext --- .../main/scala/org/ergoplatform/sdk/js/Isos.scala | 4 ++-- .../scala/org/ergoplatform/sdk/js/IsosSpec.scala | 2 +- .../sdk/AppkitProvingInterpreter.scala | 2 +- .../org/ergoplatform/sdk/ReducingInterpreter.scala | 2 +- .../protocol/context/ErgoLikeStateContext.scala | 14 ++------------ 5 files changed, 7 insertions(+), 17 deletions(-) diff --git a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Isos.scala b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Isos.scala index 9d0bd52bdb..1184602482 100644 --- a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Isos.scala +++ b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Isos.scala @@ -183,7 +183,7 @@ object Isos { override def to(a: BlockchainStateContext): ErgoLikeStateContext = { CErgoLikeStateContext( sigmaLastHeaders = isoArrayToColl(isoHeader).to(a.sigmaLastHeaders), - previousStateDigest = ADDigest @@ isoStringToColl.to(a.previousStateDigest).toArray, + previousStateDigest = isoStringToColl.to(a.previousStateDigest), sigmaPreHeader = isoPreHeader.to(a.sigmaPreHeader) ) } @@ -191,7 +191,7 @@ object Isos { override def from(b: ErgoLikeStateContext): BlockchainStateContext = { new BlockchainStateContext( sigmaLastHeaders = isoArrayToColl(isoHeader).from(b.sigmaLastHeaders), - previousStateDigest = isoStringToColl.from(b.previousStateDigest.toColl), + previousStateDigest = isoStringToColl.from(b.previousStateDigest), sigmaPreHeader = isoPreHeader.from(b.sigmaPreHeader) ) } diff --git a/sdk/js/src/test/scala/org/ergoplatform/sdk/js/IsosSpec.scala b/sdk/js/src/test/scala/org/ergoplatform/sdk/js/IsosSpec.scala index 597ee2fb3e..f8e7962055 100644 --- a/sdk/js/src/test/scala/org/ergoplatform/sdk/js/IsosSpec.scala +++ b/sdk/js/src/test/scala/org/ergoplatform/sdk/js/IsosSpec.scala @@ -33,7 +33,7 @@ class IsosSpec extends AnyPropSpec with Matchers with ObjectGenerators with Sca preHeader <- preHeaderGen(headers.headOption.map(_.id).getOrElse(modifierIdBytesGen.sample.get)) } yield CErgoLikeStateContext( sigmaLastHeaders = Colls.fromItems(headers:_*), - previousStateDigest = ADDigest @@ stateRoot.digest.toArray, + previousStateDigest = stateRoot.digest, sigmaPreHeader = preHeader ) diff --git a/sdk/shared/src/main/scala/org/ergoplatform/sdk/AppkitProvingInterpreter.scala b/sdk/shared/src/main/scala/org/ergoplatform/sdk/AppkitProvingInterpreter.scala index f114325ef9..d39187c48a 100644 --- a/sdk/shared/src/main/scala/org/ergoplatform/sdk/AppkitProvingInterpreter.scala +++ b/sdk/shared/src/main/scala/org/ergoplatform/sdk/AppkitProvingInterpreter.scala @@ -186,7 +186,7 @@ class AppkitProvingInterpreter( require(util.Arrays.equals(unsignedInput.boxId, inputBox.box.id)) val context = new ErgoLikeContext( - AvlTreeData.avlTreeFromDigest(stateContext.previousStateDigest), + AvlTreeData.avlTreeFromDigest(ADDigest @@ stateContext.previousStateDigest.toArray), stateContext.sigmaLastHeaders, stateContext.sigmaPreHeader, transactionContext.dataBoxes, diff --git a/sdk/shared/src/main/scala/org/ergoplatform/sdk/ReducingInterpreter.scala b/sdk/shared/src/main/scala/org/ergoplatform/sdk/ReducingInterpreter.scala index b7d8547e32..a78c49e412 100644 --- a/sdk/shared/src/main/scala/org/ergoplatform/sdk/ReducingInterpreter.scala +++ b/sdk/shared/src/main/scala/org/ergoplatform/sdk/ReducingInterpreter.scala @@ -131,7 +131,7 @@ class ReducingInterpreter(params: ErgoLikeParameters) extends ErgoLikeInterprete require(util.Arrays.equals(unsignedInput.boxId, inputBox.box.id)) val context = new ErgoLikeContext( - AvlTreeData.avlTreeFromDigest(stateContext.previousStateDigest), + AvlTreeData.avlTreeFromDigest(ADDigest @@ stateContext.previousStateDigest.toArray), stateContext.sigmaLastHeaders, stateContext.sigmaPreHeader, transactionContext.dataBoxes, diff --git a/sdk/shared/src/main/scala/org/ergoplatform/sdk/wallet/protocol/context/ErgoLikeStateContext.scala b/sdk/shared/src/main/scala/org/ergoplatform/sdk/wallet/protocol/context/ErgoLikeStateContext.scala index 327c3a3ddf..b150c83218 100644 --- a/sdk/shared/src/main/scala/org/ergoplatform/sdk/wallet/protocol/context/ErgoLikeStateContext.scala +++ b/sdk/shared/src/main/scala/org/ergoplatform/sdk/wallet/protocol/context/ErgoLikeStateContext.scala @@ -19,7 +19,7 @@ trait ErgoLikeStateContext { /** * @return UTXO set digest from a last header (of sigmaLastHeaders) */ - def previousStateDigest: ADDigest + def previousStateDigest: Coll[Byte] /** * @return returns pre-header (header without certain fields) of the current block @@ -35,17 +35,7 @@ trait ErgoLikeStateContext { */ case class CErgoLikeStateContext( sigmaLastHeaders: Coll[special.sigma.Header], - previousStateDigest: ADDigest, + previousStateDigest: Coll[Byte], sigmaPreHeader: special.sigma.PreHeader ) extends ErgoLikeStateContext { - override def hashCode(): Int = - (sigmaLastHeaders.hashCode() * 41 + util.Arrays.hashCode(previousStateDigest)) * 41 + sigmaPreHeader.hashCode() - - override def equals(obj: Any): Boolean = (this eq obj.asInstanceOf[AnyRef]) || (obj match { - case c: CErgoLikeStateContext => - sigmaLastHeaders == c.sigmaLastHeaders && - util.Arrays.equals(previousStateDigest, c.previousStateDigest) && - sigmaPreHeader == c.sigmaPreHeader - case _ => false - }) } From 8b45afb3498577553ba58c5816968a45d2f5d77b Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Tue, 4 Jul 2023 23:42:24 +0200 Subject: [PATCH 36/58] compiler-js: update scorex-util and scrypto deps --- build.sbt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index de7c708e56..7053fd6555 100644 --- a/build.sbt +++ b/build.sbt @@ -82,13 +82,13 @@ ThisBuild / dynverSeparator := "-" val bouncycastleBcprov = "org.bouncycastle" % "bcprov-jdk15on" % "1.66" -val scrypto = "org.scorexfoundation" %% "scrypto" % "2.3.0-3-6c1cc2fe-SNAPSHOT" +val scrypto = "org.scorexfoundation" %% "scrypto" % "2.3.0-4-a0bc6176-SNAPSHOT" val scryptoDependency = - libraryDependencies += "org.scorexfoundation" %%% "scrypto" % "2.3.0-3-6c1cc2fe-SNAPSHOT" + libraryDependencies += "org.scorexfoundation" %%% "scrypto" % "2.3.0-4-a0bc6176-SNAPSHOT" -val scorexUtil = "org.scorexfoundation" %% "scorex-util" % "0.2.0-2-d2b192dc-SNAPSHOT" +val scorexUtil = "org.scorexfoundation" %% "scorex-util" % "0.2.1" val scorexUtilDependency = - libraryDependencies += "org.scorexfoundation" %%% "scorex-util" % "0.2.0-2-d2b192dc-SNAPSHOT" + libraryDependencies += "org.scorexfoundation" %%% "scorex-util" % "0.2.1" val debox = "org.scorexfoundation" %% "debox" % "0.10.0" val spireMacros = "org.typelevel" %% "spire-macros" % "0.17.0-M1" From 933acd7a3753725c8b41994c2126a20279b6809b Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Thu, 6 Jul 2023 10:08:15 +0200 Subject: [PATCH 37/58] compiler-js: rename sigma-js test files --- .../scala/org/ergoplatform/sdk/js/Value.scala | 6 +- .../js/{sc.spec.js => SigmaCompiler.spec.js} | 2 +- .../tests/js/{sdk.spec.js => Type.spec.js} | 0 sigma-js/tests/js/Value.spec.js | 73 +++++++++++++++++++ 4 files changed, 79 insertions(+), 2 deletions(-) rename sigma-js/tests/js/{sc.spec.js => SigmaCompiler.spec.js} (91%) rename sigma-js/tests/js/{sdk.spec.js => Type.spec.js} (100%) create mode 100644 sigma-js/tests/js/Value.spec.js diff --git a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala index 3d570e118d..d5c9b0da89 100644 --- a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala +++ b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala @@ -4,10 +4,11 @@ import scalan.RType import scalan.RType.PairType import scorex.util.Extensions.{IntOps, LongOps} import scorex.util.encode.Base16 -import sigmastate.eval.{Colls, Evaluation} +import sigmastate.eval.{Colls, Evaluation, SigmaDsl} import sigmastate.serialization.{DataSerializer, SigmaSerializer} import sigmastate.SType import Value.toRuntimeData +import org.ergoplatform.sdk.JavaHelpers.BigIntRType import special.collection.{Coll, CollType} import scala.scalajs.js @@ -101,6 +102,9 @@ object Value extends js.Object { final private[js] def fromRuntimeData(value: Any, rtype: RType[_]): Any = rtype match { case RType.ByteType | RType.ShortType | RType.IntType => value case RType.LongType => js.BigInt(value.asInstanceOf[Long].toString) + case special.sigma.BigIntRType => + val hex = SigmaDsl.toBigInteger(value.asInstanceOf[special.sigma.BigInt]).toString(16) + js.BigInt(hex) case ct: CollType[a] => val arr = value.asInstanceOf[Coll[a]].toArray js.Array(arr.map(x => fromRuntimeData(x, ct.tItem)):_*) diff --git a/sigma-js/tests/js/sc.spec.js b/sigma-js/tests/js/SigmaCompiler.spec.js similarity index 91% rename from sigma-js/tests/js/sc.spec.js rename to sigma-js/tests/js/SigmaCompiler.spec.js index eff7ba556f..f265faae39 100644 --- a/sigma-js/tests/js/sc.spec.js +++ b/sigma-js/tests/js/SigmaCompiler.spec.js @@ -1,4 +1,4 @@ -const { TypeObj, ValueObj, ErgoTree, SigmaCompiler, SigmaCompilerObj } = require("sigmastate-js"); +const { ValueObj, SigmaCompilerObj } = require("sigmastate-js"); describe("Smoke tests for API exporting", () => { let compiler = SigmaCompilerObj.forMainnet(); diff --git a/sigma-js/tests/js/sdk.spec.js b/sigma-js/tests/js/Type.spec.js similarity index 100% rename from sigma-js/tests/js/sdk.spec.js rename to sigma-js/tests/js/Type.spec.js diff --git a/sigma-js/tests/js/Value.spec.js b/sigma-js/tests/js/Value.spec.js new file mode 100644 index 0000000000..ddc2e4a228 --- /dev/null +++ b/sigma-js/tests/js/Value.spec.js @@ -0,0 +1,73 @@ +const { TypeObj, ValueObj } = require("sigmastate-js"); + +function testRange(factory, min, max) { + expect(factory(max).data).toEqual(max); + expect(() => factory(max + 1).data).toThrow(); + expect(factory(-1).data).toEqual(-1); + expect(factory(min).data).toEqual(min); + expect(() => factory(min - 1).data).toThrow(); +} + +describe("Smoke tests for Values", () => { + it("Should create values of primitive types", () => { + expect(ValueObj.ofByte(0).data).toEqual(0); + expect(ValueObj.ofByte(0).tpe).toEqual(TypeObj.Byte); + testRange(function(v) { return ValueObj.ofByte(v); }, -128, 127); + testRange(function(v) { return ValueObj.ofShort(v); }, -32768, 32767); + testRange(function(v) { return ValueObj.ofInt(v); }, -0x7FFFFFFF - 1, 0x7FFFFFFF); + testRange(function(v) { return ValueObj.ofLong(v); }, -0x8000000000000000n, 0x7fffffffffffffffn); + }); + + it("Should create values of complex types", () => { + let pair = ValueObj.pairOf(ValueObj.ofByte(10), ValueObj.ofLong(20n)); + expect(pair.data).toEqual([10, 20n]); + expect(pair.tpe.name).toEqual("(Byte, Long)"); + + let coll = ValueObj.collOf([-10, 0, 10], TypeObj.Byte) + expect(coll.tpe.name).toEqual("Coll[Byte]"); + }); + + let longHex = "05e012"; + let collHex = "1a0203010203020a14"; + let pairHex = "3e050a28" + + it("Long Value.toHex", () => { + let v = ValueObj.ofLong(1200n) + expect(v.toHex()).toEqual(longHex) + }); + + it("Coll Value.toHex", () => { + let arr = [ [1, 2, 3], [10, 20] ] + let t = TypeObj.collType(TypeObj.Byte) + let collV = ValueObj.collOf(arr, t) + + expect(collV.tpe.name).toEqual("Coll[Coll[Byte]]"); + expect(collV.toHex()).toEqual(collHex) + }); + + it("Pair Value.toHex", () => { + let fst = ValueObj.ofByte(10) + let snd = ValueObj.ofLong(20) + let pair = ValueObj.pairOf(fst, snd) + expect(pair.tpe.name).toEqual("(Byte, Long)"); + expect(pair.toHex()).toEqual(pairHex) + }); + + it("Long Value.fromHex", () => { + let v = ValueObj.fromHex(longHex) + expect(v.data).toEqual(1200n) + expect(v.tpe.name).toEqual("Long") + }); + + it("Coll Value.fromHex", () => { + let coll = ValueObj.fromHex(collHex) + expect(coll.tpe.name).toEqual("Coll[Coll[Byte]]"); + expect(coll.toHex()).toEqual(collHex) + }); + + it("Pair Value.fromHex", () => { + let p = ValueObj.fromHex(pairHex) + expect(p.tpe.name).toEqual("(Byte, Long)"); + expect(p.toHex()).toEqual(pairHex) + }); +}); From 27ed0922eca738bea7ddb9a88ab0dca93e8d4bd8 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Thu, 6 Jul 2023 10:15:10 +0200 Subject: [PATCH 38/58] compiler-js: fix URLs in README.md --- sigma-js/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sigma-js/README.md b/sigma-js/README.md index 0092f24e2e..22975e60cd 100644 --- a/sigma-js/README.md +++ b/sigma-js/README.md @@ -35,20 +35,20 @@ Import `TypeObj` module, then use: - method `TypeObj.pairType` (e.g. `TypeObj.pairType(TypeObj.Int, TypeObj.Long)`) - method `TypeObj.collType` (e.g. `TypeObj.collType(TypeObj.Int)`) -See examples in tests [sdk.spec.js](https://github.com/ScorexFoundation/sigmastate-interpreter/blob/1ac06c8014ca7f75388039934970d3ef0a370700/sigma-js/tests/js/sdk.spec.js) +See examples in tests [Type.spec.js](https://github.com/ScorexFoundation/sigmastate-interpreter/blob/933acd7a3753725c8b41994c2126a20279b6809b/sigma-js/tests/js/Type.spec.js) ### How to create Sigma values Import `ValueObj` module, then use its methods. -See examples in tests [sdk.spec.js](https://github.com/ScorexFoundation/sigmastate-interpreter/blob/1ac06c8014ca7f75388039934970d3ef0a370700/sigma-js/tests/js/sdk.spec.js) +See examples in tests [Value.spec.js](https://github.com/ScorexFoundation/sigmastate-interpreter/blob/933acd7a3753725c8b41994c2126a20279b6809b/sigma-js/tests/js/Value.spec.js) ### How to work with ErgoTree Import `ErgoTreeObj` module, and `ErgoTree` class then use its methods. -See examples in tests [sdk.spec.js](https://github.com/ScorexFoundation/sigmastate-interpreter/blob/1ac06c8014ca7f75388039934970d3ef0a370700/sigma-js/tests/js/sdk.spec.js) +See examples in tests [ErgoTree.spec.js](https://github.com/ScorexFoundation/sigmastate-interpreter/blob/79df4ca171a77233947d835042ce5c82ee520469/sigma-js/tests/js/ErgoTree.spec.js) ### Compile ErgoScript to ErgoTree Import `SigmaCompilerObj` module and `SigmaCompiler` class, then use its methods. -See compiler tests in [sc.spec.js](https://github.com/ScorexFoundation/sigmastate-interpreter/blob/04ce57092243ede3647b02d1bb77b0868e0a9069/sigma-js/tests/js/sc.spec.js) +See compiler tests in [SigmaCompiler.spec.js](https://github.com/ScorexFoundation/sigmastate-interpreter/blob/933acd7a3753725c8b41994c2126a20279b6809b/sigma-js/tests/js/SigmaCompiler.spec.js) From 5986387c4d0c6fc3b75783453cdf110a42b04970 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Thu, 6 Jul 2023 16:35:46 +0200 Subject: [PATCH 39/58] compiler-js: implemented js.Value for BigInt --- .../org/ergoplatform/sdk/js/AvlTree.scala | 16 ++++ .../org/ergoplatform/sdk/js/Header.scala | 17 ---- .../scala/org/ergoplatform/sdk/js/Type.scala | 29 +++++++ .../scala/org/ergoplatform/sdk/js/Value.scala | 35 ++++---- .../org/ergoplatform/sdk/js/ValueSpec.scala | 18 ++++ sigma-js/tests/js/Type.spec.js | 85 +++---------------- sigma-js/tests/js/Value.spec.js | 6 ++ 7 files changed, 101 insertions(+), 105 deletions(-) create mode 100644 sdk/js/src/main/scala/org/ergoplatform/sdk/js/AvlTree.scala create mode 100644 sdk/js/src/test/scala/org/ergoplatform/sdk/js/ValueSpec.scala diff --git a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/AvlTree.scala b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/AvlTree.scala new file mode 100644 index 0000000000..19edc35f40 --- /dev/null +++ b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/AvlTree.scala @@ -0,0 +1,16 @@ +package org.ergoplatform.sdk.js + +import scala.scalajs.js +import scala.scalajs.js.UndefOr +import scala.scalajs.js.annotation.JSExportTopLevel + +/** Equivalent of [[special.sigma.AvlTree]] available from JS. */ +@JSExportTopLevel("AvlTree") +class AvlTree( + val digest: String, + val insertAllowed: Boolean, + val updateAllowed: Boolean, + val removeAllowed: Boolean, + val keyLength: Int, + val valueLengthOpt: UndefOr[Int] +) extends js.Object diff --git a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Header.scala b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Header.scala index f1cf5d5dac..fecd4ef67c 100644 --- a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Header.scala +++ b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Header.scala @@ -1,25 +1,8 @@ package org.ergoplatform.sdk.js -import scorex.crypto.authds.ADDigest -import sigmastate.AvlTreeFlags -import special.sigma - import scala.scalajs.js -import scala.scalajs.js.UndefOr import scala.scalajs.js.annotation.JSExportTopLevel - -/** Equivalent of [[special.sigma.AvlTree]] available from JS. */ -@JSExportTopLevel("AvlTree") -class AvlTree( - val digest: String, - val insertAllowed: Boolean, - val updateAllowed: Boolean, - val removeAllowed: Boolean, - val keyLength: Int, - val valueLengthOpt: UndefOr[Int] -) extends js.Object - /** Equivalent of [[special.sigma.Header]] available from JS. */ @JSExportTopLevel("Header") class Header( diff --git a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Type.scala b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Type.scala index 51cea3f57b..ba4c7128b9 100644 --- a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Type.scala +++ b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Type.scala @@ -31,6 +31,35 @@ object Type extends js.Object { /** Descriptor of ErgoScript type Long. */ val Long = new Type(RType.LongType) + /** Descriptor of ErgoScript type BigInt. */ + val BigInt = new Type(special.sigma.BigIntRType) + + /** Descriptor of ErgoScript type GroupElement. */ + val GroupElement = new Type(special.sigma.GroupElementRType) + + /** Descriptor of ErgoScript type SigmaProp. */ + val SigmaProp = new Type(special.sigma.SigmaPropRType) + + /** Descriptor of ErgoScript type Box. */ + val Box = new Type(special.sigma.BoxRType) + + /** Descriptor of ErgoScript type AvlTree. */ + val AvlTree = new Type(special.sigma.AvlTreeRType) + + /** Descriptor of ErgoScript type Context. */ + val Context = new Type(special.sigma.ContextRType) + + /** Descriptor of ErgoScript type Header. */ + val Header = new Type(special.sigma.HeaderRType) + + /** Descriptor of ErgoScript type PreHeader. */ + val PreHeader = new Type(special.sigma.PreHeaderRType) + + /** Descriptor of ErgoScript type Global. + * @see SigmaDslBuilder, SGlobal + */ + val SigmaDslBuilder = new Type(special.sigma.SigmaDslBuilderRType) + /** Constructs a new descriptor of ErgoScript pair type (l, r). * @param l first component of the pair * @param r second component of the pair diff --git a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala index d5c9b0da89..8ad4c3af59 100644 --- a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala +++ b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala @@ -5,12 +5,13 @@ import scalan.RType.PairType import scorex.util.Extensions.{IntOps, LongOps} import scorex.util.encode.Base16 import sigmastate.eval.{Colls, Evaluation, SigmaDsl} -import sigmastate.serialization.{DataSerializer, SigmaSerializer} +import sigmastate.serialization.{ConstantSerializer, DataSerializer, SigmaSerializer} import sigmastate.SType import Value.toRuntimeData -import org.ergoplatform.sdk.JavaHelpers.BigIntRType +import sigmastate.lang.DeserializationSigmaBuilder import special.collection.{Coll, CollType} +import java.math.BigInteger import scala.scalajs.js import scala.scalajs.js.annotation.JSExportTopLevel @@ -79,6 +80,9 @@ object Value extends js.Object { final private[js] def toRuntimeData(data: Any, rtype: RType[_]): Any = rtype match { case RType.ByteType | RType.ShortType | RType.IntType => data case RType.LongType => java.lang.Long.parseLong(data.asInstanceOf[js.BigInt].toString(10)) + case special.sigma.BigIntRType => + val v = data.asInstanceOf[js.BigInt] + SigmaDsl.BigInt(new BigInteger(v.toString(16), 16)) case ct: CollType[a] => val xs = data.asInstanceOf[js.Array[Any]] implicit val cT = ct.tItem.classTag @@ -103,7 +107,7 @@ object Value extends js.Object { case RType.ByteType | RType.ShortType | RType.IntType => value case RType.LongType => js.BigInt(value.asInstanceOf[Long].toString) case special.sigma.BigIntRType => - val hex = SigmaDsl.toBigInteger(value.asInstanceOf[special.sigma.BigInt]).toString(16) + val hex = SigmaDsl.toBigInteger(value.asInstanceOf[special.sigma.BigInt]).toString(10) js.BigInt(hex) case ct: CollType[a] => val arr = value.asInstanceOf[Coll[a]].toArray @@ -129,8 +133,10 @@ object Value extends js.Object { if (n < MinLong || n > MaxLong) throw new ArithmeticException(s"value $n is out of long range") n + case special.sigma.BigIntRType => + data.asInstanceOf[js.BigInt] case PairType(l, r) => data match { - case arr: js.Array[Any] => + case arr: js.Array[Any @unchecked] => checkJsData(arr(0), l) checkJsData(arr(1), r) data @@ -138,7 +144,7 @@ object Value extends js.Object { throw new ArithmeticException(s"$data cannot represent pair value") } case CollType(elemType) => data match { - case arr: js.Array[Any] => + case arr: js.Array[Any @unchecked] => arr.foreach(x => checkJsData(x, elemType)) data case _ => @@ -172,6 +178,12 @@ object Value extends js.Object { new Value(n, Type.Long) } + /** Create BigInt value from JS BigInt. */ + def ofBigInt(n: js.BigInt): Value = { + checkJsData(n, Type.BigInt.rtype) + new Value(n, Type.BigInt) + } + /** Create Pair value from two values. */ def pairOf(l: Value, r: Value): Value = { val data = js.Array(l.data, r.data) // the l and r data have been validated @@ -200,16 +212,9 @@ object Value extends js.Object { * @return new deserialized ErgoValue instance */ def fromHex(hex: String): Value = { - // this can be implemented using ConstantSerializer and isoValueToConstant, but this - // will add dependence on Constant and Values, which we want to avoid facilitate - // module splitting - // TODO simplify if module splitting fails val bytes = Base16.decode(hex).fold(t => throw t, identity) - val r = SigmaSerializer.startReader(bytes) - val stype = r.getType() - val value = DataSerializer.deserialize(stype, r) - val rtype = Evaluation.stypeToRType(stype) - val jsvalue = fromRuntimeData(value, rtype) - new Value(jsvalue, new Type(rtype)) + val S = ConstantSerializer(DeserializationSigmaBuilder) + val c = S.deserialize(SigmaSerializer.startReader(bytes)) + Isos.isoValueToConstant.from(c) } } diff --git a/sdk/js/src/test/scala/org/ergoplatform/sdk/js/ValueSpec.scala b/sdk/js/src/test/scala/org/ergoplatform/sdk/js/ValueSpec.scala new file mode 100644 index 0000000000..84515e44dd --- /dev/null +++ b/sdk/js/src/test/scala/org/ergoplatform/sdk/js/ValueSpec.scala @@ -0,0 +1,18 @@ +package org.ergoplatform.sdk.js + +import org.scalatest.matchers.should.Matchers +import org.scalatest.propspec.AnyPropSpec +import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks +import sigmastate.Values.BigIntConstant +import sigmastate.serialization.generators.ObjectGenerators + +import java.math.BigInteger + +class ValueSpec extends AnyPropSpec with Matchers with ObjectGenerators with ScalaCheckPropertyChecks { + + property("BigInt toHex()") { + val bigValue = BigInteger.valueOf(Long.MaxValue).multiply(BigInteger.valueOf(2)) + val v = Isos.isoValueToConstant.from(BigIntConstant(bigValue)) + v.toHex() shouldBe "060900fffffffffffffffe" + } +} diff --git a/sigma-js/tests/js/Type.spec.js b/sigma-js/tests/js/Type.spec.js index 249dc2eb96..089151331d 100644 --- a/sigma-js/tests/js/Type.spec.js +++ b/sigma-js/tests/js/Type.spec.js @@ -1,12 +1,23 @@ -const { TypeObj, ValueObj } = require("sigmastate-js"); +const { TypeObj } = require("sigmastate-js"); describe("Smoke tests for Types", () => { + it("Should create primitive types", () => { expect(TypeObj.Byte.name).toEqual("Byte"); expect(TypeObj.Short.name).toEqual("Short"); expect(TypeObj.Int.name).toEqual("Int"); expect(TypeObj.Long.name).toEqual("Long"); + expect(TypeObj.BigInt.name).toEqual("BigInt"); + expect(TypeObj.GroupElement.name).toEqual("GroupElement"); + expect(TypeObj.SigmaProp.name).toEqual("SigmaProp"); + expect(TypeObj.Box.name).toEqual("Box"); + expect(TypeObj.AvlTree.name).toEqual("AvlTree"); + expect(TypeObj.Context.name).toEqual("Context"); + expect(TypeObj.Header.name).toEqual("Header"); + expect(TypeObj.PreHeader.name).toEqual("PreHeader"); + expect(TypeObj.SigmaDslBuilder.name).toEqual("SigmaDslBuilder"); }); + it("Should create complex types", () => { expect(TypeObj.pairType(TypeObj.Int, TypeObj.Long).name).toEqual("(Int, Long)"); expect(TypeObj.collType(TypeObj.Int).name).toEqual("Coll[Int]"); @@ -14,75 +25,3 @@ describe("Smoke tests for Types", () => { .toEqual("Coll[(Int, Long)]"); }); }); - -function testRange(factory, min, max) { - expect(factory(max).data).toEqual(max); - expect(() => factory(max + 1).data).toThrow(); - expect(factory(-1).data).toEqual(-1); - expect(factory(min).data).toEqual(min); - expect(() => factory(min - 1).data).toThrow(); -} - -describe("Smoke tests for Values", () => { - it("Should create values of primitive types", () => { - expect(ValueObj.ofByte(0).data).toEqual(0); - expect(ValueObj.ofByte(0).tpe).toEqual(TypeObj.Byte); - testRange(function(v) { return ValueObj.ofByte(v); }, -128, 127); - testRange(function(v) { return ValueObj.ofShort(v); }, -32768, 32767); - testRange(function(v) { return ValueObj.ofInt(v); }, -0x7FFFFFFF - 1, 0x7FFFFFFF); - testRange(function(v) { return ValueObj.ofLong(v); }, -0x8000000000000000n, 0x7fffffffffffffffn); - }); - - it("Should create values of complex types", () => { - let pair = ValueObj.pairOf(ValueObj.ofByte(10), ValueObj.ofLong(20n)); - expect(pair.data).toEqual([10, 20n]); - expect(pair.tpe.name).toEqual("(Byte, Long)"); - - let coll = ValueObj.collOf([-10, 0, 10], TypeObj.Byte) - expect(coll.tpe.name).toEqual("Coll[Byte]"); - }); - - let longHex = "05e012"; - let collHex = "1a0203010203020a14"; - let pairHex = "3e050a28" - - it("Long Value.toHex", () => { - let v = ValueObj.ofLong(1200n) - expect(v.toHex()).toEqual(longHex) - }); - - it("Coll Value.toHex", () => { - let arr = [ [1, 2, 3], [10, 20] ] - let t = TypeObj.collType(TypeObj.Byte) - let collV = ValueObj.collOf(arr, t) - - expect(collV.tpe.name).toEqual("Coll[Coll[Byte]]"); - expect(collV.toHex()).toEqual(collHex) - }); - - it("Pair Value.toHex", () => { - let fst = ValueObj.ofByte(10) - let snd = ValueObj.ofLong(20) - let pair = ValueObj.pairOf(fst, snd) - expect(pair.tpe.name).toEqual("(Byte, Long)"); - expect(pair.toHex()).toEqual(pairHex) - }); - - it("Long Value.fromHex", () => { - let v = ValueObj.fromHex(longHex) - expect(v.data).toEqual(1200n) - expect(v.tpe.name).toEqual("Long") - }); - - it("Coll Value.fromHex", () => { - let coll = ValueObj.fromHex(collHex) - expect(coll.tpe.name).toEqual("Coll[Coll[Byte]]"); - expect(coll.toHex()).toEqual(collHex) - }); - - it("Pair Value.fromHex", () => { - let p = ValueObj.fromHex(pairHex) - expect(p.tpe.name).toEqual("(Byte, Long)"); - expect(p.toHex()).toEqual(pairHex) - }); -}); diff --git a/sigma-js/tests/js/Value.spec.js b/sigma-js/tests/js/Value.spec.js index ddc2e4a228..b2293e55d1 100644 --- a/sigma-js/tests/js/Value.spec.js +++ b/sigma-js/tests/js/Value.spec.js @@ -28,6 +28,7 @@ describe("Smoke tests for Values", () => { }); let longHex = "05e012"; + let bigIntHex = "060900fffffffffffffffe"; let collHex = "1a0203010203020a14"; let pairHex = "3e050a28" @@ -36,6 +37,11 @@ describe("Smoke tests for Values", () => { expect(v.toHex()).toEqual(longHex) }); + it("BigInt Value.toHex", () => { + let v = ValueObj.ofBigInt(0xfffffffffffffffen) + expect(v.toHex()).toEqual(bigIntHex) + }); + it("Coll Value.toHex", () => { let arr = [ [1, 2, 3], [10, 20] ] let t = TypeObj.collType(TypeObj.Byte) From 24a0c8d3810e6ff6691e186a36f67dd267795bcd Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Thu, 6 Jul 2023 17:33:07 +0200 Subject: [PATCH 40/58] compiler-js: implemented js.Value for GroupElement --- .../scala/org/ergoplatform/sdk/js/Value.scala | 9 ++++++- .../org/ergoplatform/sdk/js/ValueSpec.scala | 25 ++++++++++++++++--- sigma-js/tests/js/Value.spec.js | 6 +++++ 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala index 8ad4c3af59..bbde712914 100644 --- a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala +++ b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala @@ -4,10 +4,11 @@ import scalan.RType import scalan.RType.PairType import scorex.util.Extensions.{IntOps, LongOps} import scorex.util.encode.Base16 -import sigmastate.eval.{Colls, Evaluation, SigmaDsl} +import sigmastate.eval.{CGroupElement, Colls, Evaluation, SigmaDsl} import sigmastate.serialization.{ConstantSerializer, DataSerializer, SigmaSerializer} import sigmastate.SType import Value.toRuntimeData +import sigmastate.crypto.Platform import sigmastate.lang.DeserializationSigmaBuilder import special.collection.{Coll, CollType} @@ -83,6 +84,9 @@ object Value extends js.Object { case special.sigma.BigIntRType => val v = data.asInstanceOf[js.BigInt] SigmaDsl.BigInt(new BigInteger(v.toString(16), 16)) + case special.sigma.GroupElementRType => + val point = data.asInstanceOf[Platform.Point] + SigmaDsl.GroupElement(new Platform.Ecp(point)) case ct: CollType[a] => val xs = data.asInstanceOf[js.Array[Any]] implicit val cT = ct.tItem.classTag @@ -109,6 +113,9 @@ object Value extends js.Object { case special.sigma.BigIntRType => val hex = SigmaDsl.toBigInteger(value.asInstanceOf[special.sigma.BigInt]).toString(10) js.BigInt(hex) + case special.sigma.GroupElementRType => + val point: Platform.Point = value.asInstanceOf[CGroupElement].wrappedValue.asInstanceOf[Platform.Ecp].point + point case ct: CollType[a] => val arr = value.asInstanceOf[Coll[a]].toArray js.Array(arr.map(x => fromRuntimeData(x, ct.tItem)):_*) diff --git a/sdk/js/src/test/scala/org/ergoplatform/sdk/js/ValueSpec.scala b/sdk/js/src/test/scala/org/ergoplatform/sdk/js/ValueSpec.scala index 84515e44dd..43e0ffb232 100644 --- a/sdk/js/src/test/scala/org/ergoplatform/sdk/js/ValueSpec.scala +++ b/sdk/js/src/test/scala/org/ergoplatform/sdk/js/ValueSpec.scala @@ -3,16 +3,33 @@ package org.ergoplatform.sdk.js import org.scalatest.matchers.should.Matchers import org.scalatest.propspec.AnyPropSpec import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks -import sigmastate.Values.BigIntConstant +import scorex.util.encode.Base16 +import sigmastate.SType +import sigmastate.Values.{BigIntConstant, Constant, GroupElementConstant} +import sigmastate.basics.CryptoConstants.dlogGroup +import sigmastate.crypto.CryptoFacade +import sigmastate.lang.DeserializationSigmaBuilder +import sigmastate.serialization.ConstantSerializer import sigmastate.serialization.generators.ObjectGenerators import java.math.BigInteger class ValueSpec extends AnyPropSpec with Matchers with ObjectGenerators with ScalaCheckPropertyChecks { + def test[T <: SType](c: Constant[T], expectedHex: String) = { + val v = Isos.isoValueToConstant.from(c) + val S = ConstantSerializer(DeserializationSigmaBuilder) + Base16.encode(S.toBytes(c)) shouldBe expectedHex + v.toHex() shouldBe expectedHex + } + property("BigInt toHex()") { - val bigValue = BigInteger.valueOf(Long.MaxValue).multiply(BigInteger.valueOf(2)) - val v = Isos.isoValueToConstant.from(BigIntConstant(bigValue)) - v.toHex() shouldBe "060900fffffffffffffffe" + val bigValue = BigInteger.valueOf(Long.MaxValue).multiply(BigInteger.valueOf(2)) + test(BigIntConstant(bigValue), "060900fffffffffffffffe") + } + + property("GroupElement toHex()") { + val ge = CryptoFacade.exponentiatePoint(dlogGroup.generator, BigInteger.valueOf(2)) + test(GroupElementConstant(ge), "0702c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5") } } diff --git a/sigma-js/tests/js/Value.spec.js b/sigma-js/tests/js/Value.spec.js index b2293e55d1..fb53f4a53a 100644 --- a/sigma-js/tests/js/Value.spec.js +++ b/sigma-js/tests/js/Value.spec.js @@ -29,6 +29,7 @@ describe("Smoke tests for Values", () => { let longHex = "05e012"; let bigIntHex = "060900fffffffffffffffe"; + let groupElementHex = "0702c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5"; let collHex = "1a0203010203020a14"; let pairHex = "3e050a28" @@ -42,6 +43,11 @@ describe("Smoke tests for Values", () => { expect(v.toHex()).toEqual(bigIntHex) }); + it("GroupElement Value.toHex", () => { + let v = ValueObj.fromHex(groupElementHex) + expect(v.toHex()).toEqual(groupElementHex) + }); + it("Coll Value.toHex", () => { let arr = [ [1, 2, 3], [10, 20] ] let t = TypeObj.collType(TypeObj.Byte) From 411b1f699624294dcd61b34f34725cf52a18c249 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Thu, 6 Jul 2023 17:57:28 +0200 Subject: [PATCH 41/58] compiler-js: implemented js.Value for SigmaProp --- .../org/ergoplatform/sdk/js/SigmaProp.scala | 9 ++++++++ .../scala/org/ergoplatform/sdk/js/Value.scala | 7 +++++- .../org/ergoplatform/sdk/js/ValueSpec.scala | 23 +++++++++++++++---- sigma-js/tests/js/Value.spec.js | 6 +++++ 4 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 sdk/js/src/main/scala/org/ergoplatform/sdk/js/SigmaProp.scala diff --git a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/SigmaProp.scala b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/SigmaProp.scala new file mode 100644 index 0000000000..f0e8504e1e --- /dev/null +++ b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/SigmaProp.scala @@ -0,0 +1,9 @@ +package org.ergoplatform.sdk.js + +import sigmastate.Values.SigmaBoolean +import scala.scalajs.js +import scala.scalajs.js.annotation.JSExportTopLevel + +/** Equivalent of [[special.sigma.Header]] available from JS. */ +@JSExportTopLevel("SigmaProp") +class SigmaProp(val sigmaBoolean: SigmaBoolean) extends js.Object diff --git a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala index bbde712914..ed0952bf1d 100644 --- a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala +++ b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala @@ -4,7 +4,7 @@ import scalan.RType import scalan.RType.PairType import scorex.util.Extensions.{IntOps, LongOps} import scorex.util.encode.Base16 -import sigmastate.eval.{CGroupElement, Colls, Evaluation, SigmaDsl} +import sigmastate.eval.{CGroupElement, CSigmaProp, Colls, Evaluation, SigmaDsl} import sigmastate.serialization.{ConstantSerializer, DataSerializer, SigmaSerializer} import sigmastate.SType import Value.toRuntimeData @@ -87,6 +87,9 @@ object Value extends js.Object { case special.sigma.GroupElementRType => val point = data.asInstanceOf[Platform.Point] SigmaDsl.GroupElement(new Platform.Ecp(point)) + case special.sigma.SigmaPropRType => + val p = data.asInstanceOf[SigmaProp] + SigmaDsl.SigmaProp(p.sigmaBoolean) case ct: CollType[a] => val xs = data.asInstanceOf[js.Array[Any]] implicit val cT = ct.tItem.classTag @@ -116,6 +119,8 @@ object Value extends js.Object { case special.sigma.GroupElementRType => val point: Platform.Point = value.asInstanceOf[CGroupElement].wrappedValue.asInstanceOf[Platform.Ecp].point point + case special.sigma.SigmaPropRType => + new SigmaProp(value.asInstanceOf[CSigmaProp].wrappedValue) case ct: CollType[a] => val arr = value.asInstanceOf[Coll[a]].toArray js.Array(arr.map(x => fromRuntimeData(x, ct.tItem)):_*) diff --git a/sdk/js/src/test/scala/org/ergoplatform/sdk/js/ValueSpec.scala b/sdk/js/src/test/scala/org/ergoplatform/sdk/js/ValueSpec.scala index 43e0ffb232..23cb45c4e3 100644 --- a/sdk/js/src/test/scala/org/ergoplatform/sdk/js/ValueSpec.scala +++ b/sdk/js/src/test/scala/org/ergoplatform/sdk/js/ValueSpec.scala @@ -5,31 +5,44 @@ import org.scalatest.propspec.AnyPropSpec import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks import scorex.util.encode.Base16 import sigmastate.SType -import sigmastate.Values.{BigIntConstant, Constant, GroupElementConstant} +import sigmastate.Values.{BigIntConstant, Constant, GroupElementConstant, SigmaPropConstant} import sigmastate.basics.CryptoConstants.dlogGroup +import sigmastate.basics.DLogProtocol.ProveDlog import sigmastate.crypto.CryptoFacade +import sigmastate.eval.{CSigmaProp, SigmaDsl} import sigmastate.lang.DeserializationSigmaBuilder import sigmastate.serialization.ConstantSerializer -import sigmastate.serialization.generators.ObjectGenerators +import sigmastate.utils.Helpers +import special.sigma.SigmaTestingData import java.math.BigInteger -class ValueSpec extends AnyPropSpec with Matchers with ObjectGenerators with ScalaCheckPropertyChecks { +class ValueSpec extends AnyPropSpec with Matchers with SigmaTestingData with ScalaCheckPropertyChecks { def test[T <: SType](c: Constant[T], expectedHex: String) = { val v = Isos.isoValueToConstant.from(c) val S = ConstantSerializer(DeserializationSigmaBuilder) Base16.encode(S.toBytes(c)) shouldBe expectedHex v.toHex() shouldBe expectedHex + Isos.isoValueToConstant.to(Value.fromHex(expectedHex)) shouldBe c } - property("BigInt toHex()") { + property("BigInt toHex()/fromHex()") { val bigValue = BigInteger.valueOf(Long.MaxValue).multiply(BigInteger.valueOf(2)) test(BigIntConstant(bigValue), "060900fffffffffffffffe") } - property("GroupElement toHex()") { + property("GroupElement toHex()/fromHex()") { val ge = CryptoFacade.exponentiatePoint(dlogGroup.generator, BigInteger.valueOf(2)) test(GroupElementConstant(ge), "0702c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5") } + + property("SigmaProp toHex()/fromHex()") { + val c = SigmaPropConstant( + CSigmaProp( + ProveDlog( + Helpers.decodeECPoint("0297c44a12f4eb99a85d298fa3ba829b5b42b9f63798c980ece801cc663cc5fc9e") + ))) + test(c, "08cd0297c44a12f4eb99a85d298fa3ba829b5b42b9f63798c980ece801cc663cc5fc9e") + } } diff --git a/sigma-js/tests/js/Value.spec.js b/sigma-js/tests/js/Value.spec.js index fb53f4a53a..27e97522c3 100644 --- a/sigma-js/tests/js/Value.spec.js +++ b/sigma-js/tests/js/Value.spec.js @@ -30,6 +30,7 @@ describe("Smoke tests for Values", () => { let longHex = "05e012"; let bigIntHex = "060900fffffffffffffffe"; let groupElementHex = "0702c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5"; + let sigmaPropHex = "08cd0297c44a12f4eb99a85d298fa3ba829b5b42b9f63798c980ece801cc663cc5fc9e"; let collHex = "1a0203010203020a14"; let pairHex = "3e050a28" @@ -48,6 +49,11 @@ describe("Smoke tests for Values", () => { expect(v.toHex()).toEqual(groupElementHex) }); + it("SigmaProp Value.toHex", () => { + let v = ValueObj.fromHex(sigmaPropHex) + expect(v.toHex()).toEqual(sigmaPropHex) + }); + it("Coll Value.toHex", () => { let arr = [ [1, 2, 3], [10, 20] ] let t = TypeObj.collType(TypeObj.Byte) From ccdf546fa074604cfede925713669603483cabc6 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Thu, 6 Jul 2023 21:23:06 +0200 Subject: [PATCH 42/58] compiler-js: implemented js.Value for AvlTree --- sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala | 7 ++++++- .../test/scala/org/ergoplatform/sdk/js/ValueSpec.scala | 8 ++++++-- sigma-js/tests/js/Value.spec.js | 6 ++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala index ed0952bf1d..4e916a9c06 100644 --- a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala +++ b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala @@ -4,7 +4,7 @@ import scalan.RType import scalan.RType.PairType import scorex.util.Extensions.{IntOps, LongOps} import scorex.util.encode.Base16 -import sigmastate.eval.{CGroupElement, CSigmaProp, Colls, Evaluation, SigmaDsl} +import sigmastate.eval.{CAvlTree, CGroupElement, CSigmaProp, Colls, Evaluation, SigmaDsl} import sigmastate.serialization.{ConstantSerializer, DataSerializer, SigmaSerializer} import sigmastate.SType import Value.toRuntimeData @@ -90,6 +90,9 @@ object Value extends js.Object { case special.sigma.SigmaPropRType => val p = data.asInstanceOf[SigmaProp] SigmaDsl.SigmaProp(p.sigmaBoolean) + case special.sigma.AvlTreeRType => + val t = data.asInstanceOf[AvlTree] + Isos.isoAvlTree.to(t) case ct: CollType[a] => val xs = data.asInstanceOf[js.Array[Any]] implicit val cT = ct.tItem.classTag @@ -121,6 +124,8 @@ object Value extends js.Object { point case special.sigma.SigmaPropRType => new SigmaProp(value.asInstanceOf[CSigmaProp].wrappedValue) + case special.sigma.AvlTreeRType => + Isos.isoAvlTree.from(value.asInstanceOf[CAvlTree]) case ct: CollType[a] => val arr = value.asInstanceOf[Coll[a]].toArray js.Array(arr.map(x => fromRuntimeData(x, ct.tItem)):_*) diff --git a/sdk/js/src/test/scala/org/ergoplatform/sdk/js/ValueSpec.scala b/sdk/js/src/test/scala/org/ergoplatform/sdk/js/ValueSpec.scala index 23cb45c4e3..200f7c5739 100644 --- a/sdk/js/src/test/scala/org/ergoplatform/sdk/js/ValueSpec.scala +++ b/sdk/js/src/test/scala/org/ergoplatform/sdk/js/ValueSpec.scala @@ -5,11 +5,11 @@ import org.scalatest.propspec.AnyPropSpec import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks import scorex.util.encode.Base16 import sigmastate.SType -import sigmastate.Values.{BigIntConstant, Constant, GroupElementConstant, SigmaPropConstant} +import sigmastate.Values.{AvlTreeConstant, BigIntConstant, Constant, GroupElementConstant, SigmaPropConstant} import sigmastate.basics.CryptoConstants.dlogGroup import sigmastate.basics.DLogProtocol.ProveDlog import sigmastate.crypto.CryptoFacade -import sigmastate.eval.{CSigmaProp, SigmaDsl} +import sigmastate.eval.CSigmaProp import sigmastate.lang.DeserializationSigmaBuilder import sigmastate.serialization.ConstantSerializer import sigmastate.utils.Helpers @@ -45,4 +45,8 @@ class ValueSpec extends AnyPropSpec with Matchers with SigmaTestingData with Sca ))) test(c, "08cd0297c44a12f4eb99a85d298fa3ba829b5b42b9f63798c980ece801cc663cc5fc9e") } + + property("AvlTree toHex()/fromHex()") { + test(AvlTreeConstant(TestData.t3), "643100d2e101ff01fc047c7f6f00ff80129df69a5090012f01ffca99f5bfff0c803601800100") + } } diff --git a/sigma-js/tests/js/Value.spec.js b/sigma-js/tests/js/Value.spec.js index 27e97522c3..53d268e157 100644 --- a/sigma-js/tests/js/Value.spec.js +++ b/sigma-js/tests/js/Value.spec.js @@ -31,6 +31,7 @@ describe("Smoke tests for Values", () => { let bigIntHex = "060900fffffffffffffffe"; let groupElementHex = "0702c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5"; let sigmaPropHex = "08cd0297c44a12f4eb99a85d298fa3ba829b5b42b9f63798c980ece801cc663cc5fc9e"; + let avlTreeHex = "643100d2e101ff01fc047c7f6f00ff80129df69a5090012f01ffca99f5bfff0c803601800100"; let collHex = "1a0203010203020a14"; let pairHex = "3e050a28" @@ -54,6 +55,11 @@ describe("Smoke tests for Values", () => { expect(v.toHex()).toEqual(sigmaPropHex) }); + it("AvlTree Value.toHex", () => { + let v = ValueObj.fromHex(avlTreeHex) + expect(v.toHex()).toEqual(avlTreeHex) + }); + it("Coll Value.toHex", () => { let arr = [ [1, 2, 3], [10, 20] ] let t = TypeObj.collType(TypeObj.Byte) From 3c258afa6b9c5fa667125e660e67bd30cbb8db66 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Thu, 6 Jul 2023 21:34:44 +0200 Subject: [PATCH 43/58] compiler-js: implemented js.Value for Box --- .../src/main/scala/org/ergoplatform/sdk/js/Value.scala | 9 ++++++++- .../test/scala/org/ergoplatform/sdk/js/ValueSpec.scala | 6 +++++- sigma-js/tests/js/Value.spec.js | 6 ++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala index 4e916a9c06..6b7b8bd6a3 100644 --- a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala +++ b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala @@ -4,11 +4,13 @@ import scalan.RType import scalan.RType.PairType import scorex.util.Extensions.{IntOps, LongOps} import scorex.util.encode.Base16 -import sigmastate.eval.{CAvlTree, CGroupElement, CSigmaProp, Colls, Evaluation, SigmaDsl} +import sigmastate.eval.{CAvlTree, CGroupElement, CSigmaProp, Colls, CostingBox, Evaluation, SigmaDsl} import sigmastate.serialization.{ConstantSerializer, DataSerializer, SigmaSerializer} import sigmastate.SType import Value.toRuntimeData import sigmastate.crypto.Platform +import sigmastate.fleetSdkCommon.distEsmTypesBoxesMod.Box +import sigmastate.fleetSdkCommon.distEsmTypesCommonMod import sigmastate.lang.DeserializationSigmaBuilder import special.collection.{Coll, CollType} @@ -93,6 +95,9 @@ object Value extends js.Object { case special.sigma.AvlTreeRType => val t = data.asInstanceOf[AvlTree] Isos.isoAvlTree.to(t) + case special.sigma.BoxRType => + val t = data.asInstanceOf[Box[distEsmTypesCommonMod.Amount]] + SigmaDsl.Box(Isos.isoBox.to(t)) case ct: CollType[a] => val xs = data.asInstanceOf[js.Array[Any]] implicit val cT = ct.tItem.classTag @@ -126,6 +131,8 @@ object Value extends js.Object { new SigmaProp(value.asInstanceOf[CSigmaProp].wrappedValue) case special.sigma.AvlTreeRType => Isos.isoAvlTree.from(value.asInstanceOf[CAvlTree]) + case special.sigma.BoxRType => + Isos.isoBox.from(value.asInstanceOf[CostingBox].wrappedValue) case ct: CollType[a] => val arr = value.asInstanceOf[Coll[a]].toArray js.Array(arr.map(x => fromRuntimeData(x, ct.tItem)):_*) diff --git a/sdk/js/src/test/scala/org/ergoplatform/sdk/js/ValueSpec.scala b/sdk/js/src/test/scala/org/ergoplatform/sdk/js/ValueSpec.scala index 200f7c5739..bc824794bc 100644 --- a/sdk/js/src/test/scala/org/ergoplatform/sdk/js/ValueSpec.scala +++ b/sdk/js/src/test/scala/org/ergoplatform/sdk/js/ValueSpec.scala @@ -5,7 +5,7 @@ import org.scalatest.propspec.AnyPropSpec import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks import scorex.util.encode.Base16 import sigmastate.SType -import sigmastate.Values.{AvlTreeConstant, BigIntConstant, Constant, GroupElementConstant, SigmaPropConstant} +import sigmastate.Values.{AvlTreeConstant, BigIntConstant, BoxConstant, Constant, GroupElementConstant, SigmaPropConstant} import sigmastate.basics.CryptoConstants.dlogGroup import sigmastate.basics.DLogProtocol.ProveDlog import sigmastate.crypto.CryptoFacade @@ -49,4 +49,8 @@ class ValueSpec extends AnyPropSpec with Matchers with SigmaTestingData with Sca property("AvlTree toHex()/fromHex()") { test(AvlTreeConstant(TestData.t3), "643100d2e101ff01fc047c7f6f00ff80129df69a5090012f01ffca99f5bfff0c803601800100") } + + property("Box toHex()/fromHex()") { + test(BoxConstant(TestData.b2), "63b96000d1968302010100ff83020193040204020100c0843d000401010e32297000800b80f1d56c809a8c6affbed864b87f007f6f007f00ac00018c01c4fdff011088807f0100657f00f9ab0101ff6d6505a4a7b5a2e7a4a4dd3a05feffffffffffffffff01003bd5c630803cfff6c1ff7f7fb980ff136afc011f8080b8b04ad4dbda2d7f4e01") + } } diff --git a/sigma-js/tests/js/Value.spec.js b/sigma-js/tests/js/Value.spec.js index 53d268e157..ab9032a060 100644 --- a/sigma-js/tests/js/Value.spec.js +++ b/sigma-js/tests/js/Value.spec.js @@ -32,6 +32,7 @@ describe("Smoke tests for Values", () => { let groupElementHex = "0702c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5"; let sigmaPropHex = "08cd0297c44a12f4eb99a85d298fa3ba829b5b42b9f63798c980ece801cc663cc5fc9e"; let avlTreeHex = "643100d2e101ff01fc047c7f6f00ff80129df69a5090012f01ffca99f5bfff0c803601800100"; + let boxHex = "63b96000d1968302010100ff83020193040204020100c0843d000401010e32297000800b80f1d56c809a8c6affbed864b87f007f6f007f00ac00018c01c4fdff011088807f0100657f00f9ab0101ff6d6505a4a7b5a2e7a4a4dd3a05feffffffffffffffff01003bd5c630803cfff6c1ff7f7fb980ff136afc011f8080b8b04ad4dbda2d7f4e01"; let collHex = "1a0203010203020a14"; let pairHex = "3e050a28" @@ -60,6 +61,11 @@ describe("Smoke tests for Values", () => { expect(v.toHex()).toEqual(avlTreeHex) }); + it("Box Value.toHex", () => { + let v = ValueObj.fromHex(boxHex) + expect(v.toHex()).toEqual(boxHex) + }); + it("Coll Value.toHex", () => { let arr = [ [1, 2, 3], [10, 20] ] let t = TypeObj.collType(TypeObj.Byte) From 11874fbbc15707b50c6f77669b90fc560d55ec3d Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Thu, 6 Jul 2023 22:43:22 +0200 Subject: [PATCH 44/58] compiler-js: implemented js.Value for Unit, Boolean --- .../scala/org/ergoplatform/sdk/js/Value.scala | 10 +++++-- .../org/ergoplatform/sdk/js/ValueSpec.scala | 18 ++++++++++- sigma-js/package.json | 2 +- sigma-js/tests/js/Value.spec.js | 30 +++++++++++++++++++ 4 files changed, 55 insertions(+), 5 deletions(-) diff --git a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala index 6b7b8bd6a3..b926cc54aa 100644 --- a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala +++ b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala @@ -1,17 +1,17 @@ package org.ergoplatform.sdk.js +import org.ergoplatform.sdk.js.Value.toRuntimeData import scalan.RType import scalan.RType.PairType import scorex.util.Extensions.{IntOps, LongOps} import scorex.util.encode.Base16 -import sigmastate.eval.{CAvlTree, CGroupElement, CSigmaProp, Colls, CostingBox, Evaluation, SigmaDsl} -import sigmastate.serialization.{ConstantSerializer, DataSerializer, SigmaSerializer} import sigmastate.SType -import Value.toRuntimeData import sigmastate.crypto.Platform +import sigmastate.eval.{CAvlTree, CGroupElement, CSigmaProp, Colls, CostingBox, Evaluation, SigmaDsl} import sigmastate.fleetSdkCommon.distEsmTypesBoxesMod.Box import sigmastate.fleetSdkCommon.distEsmTypesCommonMod import sigmastate.lang.DeserializationSigmaBuilder +import sigmastate.serialization.{ConstantSerializer, DataSerializer, SigmaSerializer} import special.collection.{Coll, CollType} import java.math.BigInteger @@ -81,6 +81,7 @@ object Value extends js.Object { * in register and [[sigmastate.Values.Constant]] nodes. */ final private[js] def toRuntimeData(data: Any, rtype: RType[_]): Any = rtype match { + case RType.BooleanType => data case RType.ByteType | RType.ShortType | RType.IntType => data case RType.LongType => java.lang.Long.parseLong(data.asInstanceOf[js.BigInt].toString(10)) case special.sigma.BigIntRType => @@ -108,6 +109,7 @@ object Value extends js.Object { val x = toRuntimeData(p(0), pt.tFst).asInstanceOf[a] val y = toRuntimeData(p(1), pt.tSnd).asInstanceOf[b] (x, y) + case RType.UnitType => data case _ => throw new IllegalArgumentException(s"Unsupported type $rtype") } @@ -119,6 +121,7 @@ object Value extends js.Object { * @param rtype type descriptor of Sigma runtime value */ final private[js] def fromRuntimeData(value: Any, rtype: RType[_]): Any = rtype match { + case RType.BooleanType => value case RType.ByteType | RType.ShortType | RType.IntType => value case RType.LongType => js.BigInt(value.asInstanceOf[Long].toString) case special.sigma.BigIntRType => @@ -139,6 +142,7 @@ object Value extends js.Object { case pt: PairType[a, b] => val p = value.asInstanceOf[(a, b)] js.Array(fromRuntimeData(p._1, pt.tFst), fromRuntimeData(p._2, pt.tSnd)) + case RType.UnitType => value case _ => throw new IllegalArgumentException(s"Unsupported type $rtype") } diff --git a/sdk/js/src/test/scala/org/ergoplatform/sdk/js/ValueSpec.scala b/sdk/js/src/test/scala/org/ergoplatform/sdk/js/ValueSpec.scala index bc824794bc..54ace98db5 100644 --- a/sdk/js/src/test/scala/org/ergoplatform/sdk/js/ValueSpec.scala +++ b/sdk/js/src/test/scala/org/ergoplatform/sdk/js/ValueSpec.scala @@ -5,7 +5,7 @@ import org.scalatest.propspec.AnyPropSpec import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks import scorex.util.encode.Base16 import sigmastate.SType -import sigmastate.Values.{AvlTreeConstant, BigIntConstant, BoxConstant, Constant, GroupElementConstant, SigmaPropConstant} +import sigmastate.Values.{AvlTreeConstant, BigIntConstant, BooleanConstant, BoxConstant, ByteConstant, Constant, GroupElementConstant, IntConstant, LongConstant, ShortConstant, SigmaPropConstant, UnitConstant} import sigmastate.basics.CryptoConstants.dlogGroup import sigmastate.basics.DLogProtocol.ProveDlog import sigmastate.crypto.CryptoFacade @@ -27,6 +27,17 @@ class ValueSpec extends AnyPropSpec with Matchers with SigmaTestingData with Sca Isos.isoValueToConstant.to(Value.fromHex(expectedHex)) shouldBe c } + property("Boolean toHex()/fromHex()") { + test(BooleanConstant(true), "0101") + } + + property("Numeric toHex()/fromHex()") { + test(ByteConstant(127), "027f") + test(ShortConstant(Short.MaxValue), "03feff03") + test(IntConstant(Int.MaxValue), "04feffffffffffffffff01") + test(LongConstant(Long.MaxValue), "05feffffffffffffffff01") + } + property("BigInt toHex()/fromHex()") { val bigValue = BigInteger.valueOf(Long.MaxValue).multiply(BigInteger.valueOf(2)) test(BigIntConstant(bigValue), "060900fffffffffffffffe") @@ -53,4 +64,9 @@ class ValueSpec extends AnyPropSpec with Matchers with SigmaTestingData with Sca property("Box toHex()/fromHex()") { test(BoxConstant(TestData.b2), "63b96000d1968302010100ff83020193040204020100c0843d000401010e32297000800b80f1d56c809a8c6affbed864b87f007f6f007f00ac00018c01c4fdff011088807f0100657f00f9ab0101ff6d6505a4a7b5a2e7a4a4dd3a05feffffffffffffffff01003bd5c630803cfff6c1ff7f7fb980ff136afc011f8080b8b04ad4dbda2d7f4e01") } + + property("Unit toHex()/fromHex()") { + test(UnitConstant.instance, "62") + } + } diff --git a/sigma-js/package.json b/sigma-js/package.json index 869c6177ee..6c420307be 100644 --- a/sigma-js/package.json +++ b/sigma-js/package.json @@ -1,6 +1,6 @@ { "name": "sigmastate-js", - "version": "0.1.4", + "version": "0.2.0", "description": "Sigma.js library", "main": "dist/main.js", "files": [ diff --git a/sigma-js/tests/js/Value.spec.js b/sigma-js/tests/js/Value.spec.js index ab9032a060..7341bee567 100644 --- a/sigma-js/tests/js/Value.spec.js +++ b/sigma-js/tests/js/Value.spec.js @@ -27,6 +27,11 @@ describe("Smoke tests for Values", () => { expect(coll.tpe.name).toEqual("Coll[Byte]"); }); + let unitHex = "62"; + let booleanHex = "0101"; + let byteHex = "027f"; + let shortHex = "03feff03"; + let intHex = "04feffffffffffffffff01"; let longHex = "05e012"; let bigIntHex = "060900fffffffffffffffe"; let groupElementHex = "0702c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5"; @@ -36,6 +41,31 @@ describe("Smoke tests for Values", () => { let collHex = "1a0203010203020a14"; let pairHex = "3e050a28" + it("Unit Value.toHex", () => { + let v = ValueObj.fromHex(unitHex) + expect(v.toHex()).toEqual(unitHex) + }); + + it("Boolean Value.toHex", () => { + let v = ValueObj.fromHex(booleanHex) + expect(v.toHex()).toEqual(booleanHex) + }); + + it("Byte Value.toHex", () => { + let v = ValueObj.fromHex(byteHex) + expect(v.toHex()).toEqual(byteHex) + }); + + it("Short Value.toHex", () => { + let v = ValueObj.fromHex(shortHex) + expect(v.toHex()).toEqual(shortHex) + }); + + it("Int Value.toHex", () => { + let v = ValueObj.fromHex(intHex) + expect(v.toHex()).toEqual(intHex) + }); + it("Long Value.toHex", () => { let v = ValueObj.ofLong(1200n) expect(v.toHex()).toEqual(longHex) From 0c383436d2d9b1bee0969d8562a1a29566d7ce63 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Wed, 12 Jul 2023 12:42:08 +0200 Subject: [PATCH 45/58] compiler-js: unused imports --- .../sigmastate/eval/CostingDataContext.scala | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/interpreter/shared/src/main/scala/sigmastate/eval/CostingDataContext.scala b/interpreter/shared/src/main/scala/sigmastate/eval/CostingDataContext.scala index 3b0b25090a..5ed332f3ba 100644 --- a/interpreter/shared/src/main/scala/sigmastate/eval/CostingDataContext.scala +++ b/interpreter/shared/src/main/scala/sigmastate/eval/CostingDataContext.scala @@ -1,38 +1,35 @@ package sigmastate.eval -import scorex.utils.{Ints, Longs} - -import java.math.BigInteger -import java.util.Arrays -import org.ergoplatform.{ErgoBox, SigmaConstants} +import debox.cfor import org.ergoplatform.validation.ValidationRules +import org.ergoplatform.{ErgoBox, SigmaConstants} import scalan.OverloadHack.Overloaded1 +import scalan.RType +import scalan.util.Extensions.BigIntegerOps import scorex.crypto.authds.avltree.batch._ import scorex.crypto.authds.{ADDigest, ADKey, ADValue, SerializedAdProof} +import scorex.crypto.hash.{Blake2b256, Digest32, Sha256} +import scorex.utils.{Ints, Longs} import sigmastate.SCollection.SByteArray -import sigmastate._ +import sigmastate.Values.ErgoTree.EmptyConstants import sigmastate.Values.{ConstantNode, ErgoTree, EvaluatedValue, SValue, SigmaBoolean} +import sigmastate._ import sigmastate.basics.CryptoConstants.EcPointType -import sigmastate.interpreter.Interpreter -import special.collection._ -import special.sigma._ -import sigmastate.eval.Extensions._ -import debox.cfor - -import scala.util.{Failure, Success} -import scalan.util.Extensions.BigIntegerOps -import scalan.{Nullable, RType} -import scorex.crypto.hash.{Blake2b256, Digest32, Sha256} -import sigmastate.Values.ErgoTree.EmptyConstants import sigmastate.basics.DLogProtocol.ProveDlog import sigmastate.basics.{CryptoConstants, ProveDHTuple} import sigmastate.crypto.{CryptoFacade, Ecp} -import sigmastate.lang.TransformingSigmaBuilder +import sigmastate.eval.Extensions._ +import sigmastate.interpreter.Interpreter import sigmastate.serialization.ErgoTreeSerializer.DefaultSerializer import sigmastate.serialization.{GroupElementSerializer, SigmaSerializer} +import special.collection._ +import special.sigma._ +import java.math.BigInteger +import java.util.Arrays import scala.annotation.unused import scala.reflect.ClassTag +import scala.util.{Failure, Success} /** Interface implmented by wrappers to provide access to the underlying wrapped value. */ trait WrapperOf[T] { From b65c47a5780078739aa184cbffda3d278a073d3f Mon Sep 17 00:00:00 2001 From: arobsn Date: Wed, 12 Jul 2023 15:20:08 -0300 Subject: [PATCH 46/58] include npm lock file --- .gitignore | 1 - sigma-js/package-lock.json | 6221 ++++++++++++++++++++++++++++++++++++ 2 files changed, 6221 insertions(+), 1 deletion(-) create mode 100644 sigma-js/package-lock.json diff --git a/.gitignore b/.gitignore index 3192ecc461..df18ce8ab1 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,6 @@ docs/spec/out/ test-out/ flamegraphs/ node_modules/ -package-lock.json sigma-js/.npmrc sigma-js/dist/ diff --git a/sigma-js/package-lock.json b/sigma-js/package-lock.json new file mode 100644 index 0000000000..3a56eb5323 --- /dev/null +++ b/sigma-js/package-lock.json @@ -0,0 +1,6221 @@ +{ + "name": "sigmastate-js", + "version": "0.2.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "sigmastate-js", + "version": "0.2.0", + "license": "MIT", + "dependencies": { + "@fleet-sdk/common": "0.1.0-alpha.14", + "@noble/hashes": "1.1.4", + "sigmajs-crypto-facade": "0.0.6" + }, + "devDependencies": { + "jest": "^29.0.3", + "shx": "^0.3.4", + "typescript": "^4.9.4" + } + }, + "node_modules/@ampproject/remapping": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", + "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.5.tgz", + "integrity": "sha512-Xmwn266vad+6DAqEB2A6V/CcZVp62BbwVmcOJc2RPuwih1kw02TjQvWVWlcKGbBPd+8/0V5DEkOcizRGYsspYQ==", + "dev": true, + "dependencies": { + "@babel/highlight": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.22.9", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.22.9.tgz", + "integrity": "sha512-5UamI7xkUcJ3i9qVDS+KFDEK8/7oJ55/sJMB1Ge7IEapr7KfdfV/HErR+koZwOfd+SgtFKOKRhRakdg++DcJpQ==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.22.9", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.22.9.tgz", + "integrity": "sha512-G2EgeufBcYw27U4hhoIwFcgc1XU7TlXJ3mv04oOv1WCuo900U/anZSPzEqNjwdjgffkk2Gs0AN0dW1CKVLcG7w==", + "dev": true, + "dependencies": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.22.5", + "@babel/generator": "^7.22.9", + "@babel/helper-compilation-targets": "^7.22.9", + "@babel/helper-module-transforms": "^7.22.9", + "@babel/helpers": "^7.22.6", + "@babel/parser": "^7.22.7", + "@babel/template": "^7.22.5", + "@babel/traverse": "^7.22.8", + "@babel/types": "^7.22.5", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.2", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/core/node_modules/convert-source-map": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", + "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", + "dev": true + }, + "node_modules/@babel/generator": { + "version": "7.22.9", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.22.9.tgz", + "integrity": "sha512-KtLMbmicyuK2Ak/FTCJVbDnkN1SlT8/kceFTiuDiiRUUSMnHMidxSCdG4ndkTOHHpoomWe/4xkvHkEOncwjYIw==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.5", + "@jridgewell/gen-mapping": "^0.3.2", + "@jridgewell/trace-mapping": "^0.3.17", + "jsesc": "^2.5.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.22.9", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.9.tgz", + "integrity": "sha512-7qYrNM6HjpnPHJbopxmb8hSPoZ0gsX8IvUS32JGVoy+pU9e5N0nLr1VjJoR6kA4d9dmGLxNYOjeB8sUDal2WMw==", + "dev": true, + "dependencies": { + "@babel/compat-data": "^7.22.9", + "@babel/helper-validator-option": "^7.22.5", + "browserslist": "^4.21.9", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-environment-visitor": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.5.tgz", + "integrity": "sha512-XGmhECfVA/5sAt+H+xpSg0mfrHq6FzNr9Oxh7PSEBBRUb/mL7Kz3NICXb194rCqAEdxkhPT1a88teizAFyvk8Q==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-function-name": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.22.5.tgz", + "integrity": "sha512-wtHSq6jMRE3uF2otvfuD3DIvVhOsSNshQl0Qrd7qC9oQJzHvOL4qQXlQn2916+CXGywIjpGuIkoyZRRxHPiNQQ==", + "dev": true, + "dependencies": { + "@babel/template": "^7.22.5", + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-hoist-variables": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", + "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.22.5.tgz", + "integrity": "sha512-8Dl6+HD/cKifutF5qGd/8ZJi84QeAKh+CEe1sBzz8UayBBGg1dAIJrdHOcOM5b2MpzWL2yuotJTtGjETq0qjXg==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.22.9", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.22.9.tgz", + "integrity": "sha512-t+WA2Xn5K+rTeGtC8jCsdAH52bjggG5TKRuRrAGNM/mjIbO4GxvlLMFOEz9wXY5I2XQ60PMFsAG2WIcG82dQMQ==", + "dev": true, + "dependencies": { + "@babel/helper-environment-visitor": "^7.22.5", + "@babel/helper-module-imports": "^7.22.5", + "@babel/helper-simple-access": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/helper-validator-identifier": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz", + "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-simple-access": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz", + "integrity": "sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-split-export-declaration": { + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", + "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz", + "integrity": "sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.5.tgz", + "integrity": "sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.22.5.tgz", + "integrity": "sha512-R3oB6xlIVKUnxNUxbmgq7pKjxpru24zlimpE8WK47fACIlM0II/Hm1RS8IaOI7NgCr6LNS+jl5l75m20npAziw==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.22.6.tgz", + "integrity": "sha512-YjDs6y/fVOYFV8hAf1rxd1QvR9wJe1pDBZ2AREKq/SDayfPzgk0PBnVuTCE5X1acEpMMNOVUqoe+OwiZGJ+OaA==", + "dev": true, + "dependencies": { + "@babel/template": "^7.22.5", + "@babel/traverse": "^7.22.6", + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.5.tgz", + "integrity": "sha512-BSKlD1hgnedS5XRnGOljZawtag7H1yPfQp0tdNJCHoH6AZ+Pcm9VvkrK59/Yy593Ypg0zMxH2BxD1VPYUQ7UIw==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.22.5", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/highlight/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "node_modules/@babel/highlight/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@babel/highlight/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/parser": { + "version": "7.22.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.7.tgz", + "integrity": "sha512-7NF8pOkHP5o2vpmGgNGcfAeCvOYhGLyA3Z4eBQkT1RJlWu47n63bCs93QfJ2hIAFCil7L5P2IWhs1oToVgrL0Q==", + "dev": true, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", + "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-bigint": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", + "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", + "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.12.13" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-meta": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", + "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", + "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-jsx": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.22.5.tgz", + "integrity": "sha512-gvyP4hZrgrs/wWMaocvxZ44Hw0b3W8Pe+cMxc8V1ULQ07oh8VNbIRaoD1LRZVTvD+0nieDKjfgKg89sD7rrKrg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-logical-assignment-operators": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", + "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", + "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-numeric-separator": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", + "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-catch-binding": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", + "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", + "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-top-level-await": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", + "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-typescript": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.22.5.tgz", + "integrity": "sha512-1mS2o03i7t1c6VzH6fdQ3OA8tcEIxwG18zIPRp+UY1Ihv6W+XZzBCVxExF9upussPXJ0xE9XRHwMoNs1ep/nRQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/template": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.5.tgz", + "integrity": "sha512-X7yV7eiwAxdj9k94NEylvbVHLiVG1nvzCV2EAowhxLTwODV1jl9UzZ48leOC0sH7OnuHrIkllaBgneUykIcZaw==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.22.5", + "@babel/parser": "^7.22.5", + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.22.8", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.22.8.tgz", + "integrity": "sha512-y6LPR+wpM2I3qJrsheCTwhIinzkETbplIgPBbwvqPKc+uljeA5gP+3nP8irdYt1mjQaDnlIcG+dw8OjAco4GXw==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.22.5", + "@babel/generator": "^7.22.7", + "@babel/helper-environment-visitor": "^7.22.5", + "@babel/helper-function-name": "^7.22.5", + "@babel/helper-hoist-variables": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/parser": "^7.22.7", + "@babel/types": "^7.22.5", + "debug": "^4.1.0", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.22.5.tgz", + "integrity": "sha512-zo3MIHGOkPOfoRXitsgHLjEXmlDaD/5KU1Uzuc9GNiZPhSqVxVRtxuPaSBZDsYZ9qV88AjtMtWW7ww98loJ9KA==", + "dev": true, + "dependencies": { + "@babel/helper-string-parser": "^7.22.5", + "@babel/helper-validator-identifier": "^7.22.5", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true + }, + "node_modules/@fleet-sdk/common": { + "version": "0.1.0-alpha.14", + "resolved": "https://registry.npmjs.org/@fleet-sdk/common/-/common-0.1.0-alpha.14.tgz", + "integrity": "sha512-w6AMHe77FaSb759e3EwcOVRQ/lEsCdr1pXq376B+T80do5pUcWjrlrIEKKNrEJPCyqW8nNClxIqBVqkFuPbbMw==", + "engines": { + "node": ">=10" + } + }, + "node_modules/@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", + "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", + "dev": true, + "dependencies": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/console": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.6.1.tgz", + "integrity": "sha512-Aj772AYgwTSr5w8qnyoJ0eDYvN6bMsH3ORH1ivMotrInHLKdUz6BDlaEXHdM6kODaBIkNIyQGzsMvRdOv7VG7Q==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.1", + "@types/node": "*", + "chalk": "^4.0.0", + "jest-message-util": "^29.6.1", + "jest-util": "^29.6.1", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/core": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.6.1.tgz", + "integrity": "sha512-CcowHypRSm5oYQ1obz1wfvkjZZ2qoQlrKKvlfPwh5jUXVU12TWr2qMeH8chLMuTFzHh5a1g2yaqlqDICbr+ukQ==", + "dev": true, + "dependencies": { + "@jest/console": "^29.6.1", + "@jest/reporters": "^29.6.1", + "@jest/test-result": "^29.6.1", + "@jest/transform": "^29.6.1", + "@jest/types": "^29.6.1", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-changed-files": "^29.5.0", + "jest-config": "^29.6.1", + "jest-haste-map": "^29.6.1", + "jest-message-util": "^29.6.1", + "jest-regex-util": "^29.4.3", + "jest-resolve": "^29.6.1", + "jest-resolve-dependencies": "^29.6.1", + "jest-runner": "^29.6.1", + "jest-runtime": "^29.6.1", + "jest-snapshot": "^29.6.1", + "jest-util": "^29.6.1", + "jest-validate": "^29.6.1", + "jest-watcher": "^29.6.1", + "micromatch": "^4.0.4", + "pretty-format": "^29.6.1", + "slash": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/@jest/environment": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.6.1.tgz", + "integrity": "sha512-RMMXx4ws+Gbvw3DfLSuo2cfQlK7IwGbpuEWXCqyYDcqYTI+9Ju3a5hDnXaxjNsa6uKh9PQF2v+qg+RLe63tz5A==", + "dev": true, + "dependencies": { + "@jest/fake-timers": "^29.6.1", + "@jest/types": "^29.6.1", + "@types/node": "*", + "jest-mock": "^29.6.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/expect": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.6.1.tgz", + "integrity": "sha512-N5xlPrAYaRNyFgVf2s9Uyyvr795jnB6rObuPx4QFvNJz8aAjpZUDfO4bh5G/xuplMID8PrnuF1+SfSyDxhsgYg==", + "dev": true, + "dependencies": { + "expect": "^29.6.1", + "jest-snapshot": "^29.6.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/expect-utils": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.6.1.tgz", + "integrity": "sha512-o319vIf5pEMx0LmzSxxkYYxo4wrRLKHq9dP1yJU7FoPTB0LfAKSz8SWD6D/6U3v/O52t9cF5t+MeJiRsfk7zMw==", + "dev": true, + "dependencies": { + "jest-get-type": "^29.4.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/fake-timers": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.6.1.tgz", + "integrity": "sha512-RdgHgbXyosCDMVYmj7lLpUwXA4c69vcNzhrt69dJJdf8azUrpRh3ckFCaTPNjsEeRi27Cig0oKDGxy5j7hOgHg==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.1", + "@sinonjs/fake-timers": "^10.0.2", + "@types/node": "*", + "jest-message-util": "^29.6.1", + "jest-mock": "^29.6.1", + "jest-util": "^29.6.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/globals": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.6.1.tgz", + "integrity": "sha512-2VjpaGy78JY9n9370H8zGRCFbYVWwjY6RdDMhoJHa1sYfwe6XM/azGN0SjY8kk7BOZApIejQ1BFPyH7FPG0w3A==", + "dev": true, + "dependencies": { + "@jest/environment": "^29.6.1", + "@jest/expect": "^29.6.1", + "@jest/types": "^29.6.1", + "jest-mock": "^29.6.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/reporters": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.6.1.tgz", + "integrity": "sha512-9zuaI9QKr9JnoZtFQlw4GREQbxgmNYXU6QuWtmuODvk5nvPUeBYapVR/VYMyi2WSx3jXTLJTJji8rN6+Cm4+FA==", + "dev": true, + "dependencies": { + "@bcoe/v8-coverage": "^0.2.3", + "@jest/console": "^29.6.1", + "@jest/test-result": "^29.6.1", + "@jest/transform": "^29.6.1", + "@jest/types": "^29.6.1", + "@jridgewell/trace-mapping": "^0.3.18", + "@types/node": "*", + "chalk": "^4.0.0", + "collect-v8-coverage": "^1.0.0", + "exit": "^0.1.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-instrument": "^5.1.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.1.3", + "jest-message-util": "^29.6.1", + "jest-util": "^29.6.1", + "jest-worker": "^29.6.1", + "slash": "^3.0.0", + "string-length": "^4.0.1", + "strip-ansi": "^6.0.0", + "v8-to-istanbul": "^9.0.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/@jest/schemas": { + "version": "29.6.0", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.0.tgz", + "integrity": "sha512-rxLjXyJBTL4LQeJW3aKo0M/+GkCOXsO+8i9Iu7eDb6KwtP65ayoDsitrdPBtujxQ88k4wI2FNYfa6TOGwSn6cQ==", + "dev": true, + "dependencies": { + "@sinclair/typebox": "^0.27.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/source-map": { + "version": "29.6.0", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.6.0.tgz", + "integrity": "sha512-oA+I2SHHQGxDCZpbrsCQSoMLb3Bz547JnM+jUr9qEbuw0vQlWZfpPS7CO9J7XiwKicEz9OFn/IYoLkkiUD7bzA==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.18", + "callsites": "^3.0.0", + "graceful-fs": "^4.2.9" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/test-result": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.6.1.tgz", + "integrity": "sha512-Ynr13ZRcpX6INak0TPUukU8GWRfm/vAytE3JbJNGAvINySWYdfE7dGZMbk36oVuK4CigpbhMn8eg1dixZ7ZJOw==", + "dev": true, + "dependencies": { + "@jest/console": "^29.6.1", + "@jest/types": "^29.6.1", + "@types/istanbul-lib-coverage": "^2.0.0", + "collect-v8-coverage": "^1.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/test-sequencer": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.6.1.tgz", + "integrity": "sha512-oBkC36PCDf/wb6dWeQIhaviU0l5u6VCsXa119yqdUosYAt7/FbQU2M2UoziO3igj/HBDEgp57ONQ3fm0v9uyyg==", + "dev": true, + "dependencies": { + "@jest/test-result": "^29.6.1", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.6.1", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/transform": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.6.1.tgz", + "integrity": "sha512-URnTneIU3ZjRSaf906cvf6Hpox3hIeJXRnz3VDSw5/X93gR8ycdfSIEy19FlVx8NFmpN7fe3Gb1xF+NjXaQLWg==", + "dev": true, + "dependencies": { + "@babel/core": "^7.11.6", + "@jest/types": "^29.6.1", + "@jridgewell/trace-mapping": "^0.3.18", + "babel-plugin-istanbul": "^6.1.1", + "chalk": "^4.0.0", + "convert-source-map": "^2.0.0", + "fast-json-stable-stringify": "^2.1.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.6.1", + "jest-regex-util": "^29.4.3", + "jest-util": "^29.6.1", + "micromatch": "^4.0.4", + "pirates": "^4.0.4", + "slash": "^3.0.0", + "write-file-atomic": "^4.0.2" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/types": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.1.tgz", + "integrity": "sha512-tPKQNMPuXgvdOn2/Lg9HNfUvjYVGolt04Hp03f5hAk878uwOLikN+JzeLY0HcVgKgFl9Hs3EIqpu3WX27XNhnw==", + "dev": true, + "dependencies": { + "@jest/schemas": "^29.6.0", + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^17.0.8", + "chalk": "^4.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", + "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "dev": true, + "dependencies": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", + "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.18", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz", + "integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "3.1.0", + "@jridgewell/sourcemap-codec": "1.4.14" + } + }, + "node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", + "dev": true + }, + "node_modules/@noble/hashes": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.4.tgz", + "integrity": "sha512-+PYsVPrTSqtVjatKt2A/Proukn2Yrz61OBThOCKErc5w2/r1Fh37vbDv0Eah7pyNltrmacjwTvdw3JoR+WE4TA==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ] + }, + "node_modules/@sinclair/typebox": { + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", + "dev": true + }, + "node_modules/@sinonjs/commons": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.0.tgz", + "integrity": "sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA==", + "dev": true, + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/@sinonjs/fake-timers": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz", + "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==", + "dev": true, + "dependencies": { + "@sinonjs/commons": "^3.0.0" + } + }, + "node_modules/@types/babel__core": { + "version": "7.20.1", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.1.tgz", + "integrity": "sha512-aACu/U/omhdk15O4Nfb+fHgH/z3QsfQzpnvRZhYhThms83ZnAOZz7zZAWO7mn2yyNQaA4xTO8GLK3uqFU4bYYw==", + "dev": true, + "dependencies": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "node_modules/@types/babel__generator": { + "version": "7.6.4", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.4.tgz", + "integrity": "sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg==", + "dev": true, + "dependencies": { + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__template": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.1.tgz", + "integrity": "sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g==", + "dev": true, + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__traverse": { + "version": "7.20.1", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.1.tgz", + "integrity": "sha512-MitHFXnhtgwsGZWtT68URpOvLN4EREih1u3QtQiN4VdAxWKRVvGCSvw/Qth0M0Qq3pJpnGOu5JaM/ydK7OGbqg==", + "dev": true, + "dependencies": { + "@babel/types": "^7.20.7" + } + }, + "node_modules/@types/graceful-fs": { + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.6.tgz", + "integrity": "sha512-Sig0SNORX9fdW+bQuTEovKj3uHcUL6LQKbCrrqb1X7J6/ReAbhCXRAhc+SMejhLELFj2QcyuxmUooZ4bt5ReSw==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", + "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", + "dev": true + }, + "node_modules/@types/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", + "dev": true, + "dependencies": { + "@types/istanbul-lib-coverage": "*" + } + }, + "node_modules/@types/istanbul-reports": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", + "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", + "dev": true, + "dependencies": { + "@types/istanbul-lib-report": "*" + } + }, + "node_modules/@types/node": { + "version": "20.4.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.1.tgz", + "integrity": "sha512-JIzsAvJeA/5iY6Y/OxZbv1lUcc8dNSE77lb2gnBH+/PJ3lFR1Ccvgwl5JWnHAkNHcRsT0TbpVOsiMKZ1F/yyJg==", + "dev": true + }, + "node_modules/@types/prettier": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.3.tgz", + "integrity": "sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA==", + "dev": true + }, + "node_modules/@types/stack-utils": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", + "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==", + "dev": true + }, + "node_modules/@types/yargs": { + "version": "17.0.24", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.24.tgz", + "integrity": "sha512-6i0aC7jV6QzQB8ne1joVZ0eSFIstHsCrobmOtghM11yGlH0j43FKL2UhWdELkyps0zuf7qVTUVCCR+tgSlyLLw==", + "dev": true, + "dependencies": { + "@types/yargs-parser": "*" + } + }, + "node_modules/@types/yargs-parser": { + "version": "21.0.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", + "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", + "dev": true + }, + "node_modules/ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/babel-jest": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.6.1.tgz", + "integrity": "sha512-qu+3bdPEQC6KZSPz+4Fyjbga5OODNcp49j6GKzG1EKbkfyJBxEYGVUmVGpwCSeGouG52R4EgYMLb6p9YeEEQ4A==", + "dev": true, + "dependencies": { + "@jest/transform": "^29.6.1", + "@types/babel__core": "^7.1.14", + "babel-plugin-istanbul": "^6.1.1", + "babel-preset-jest": "^29.5.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.8.0" + } + }, + "node_modules/babel-plugin-istanbul": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", + "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0", + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-instrument": "^5.0.4", + "test-exclude": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-plugin-jest-hoist": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.5.0.tgz", + "integrity": "sha512-zSuuuAlTMT4mzLj2nPnUm6fsE6270vdOfnpbJ+RmruU75UhLFvL0N2NgI7xpeS7NaB6hGqmd5pVpGTDYvi4Q3w==", + "dev": true, + "dependencies": { + "@babel/template": "^7.3.3", + "@babel/types": "^7.3.3", + "@types/babel__core": "^7.1.14", + "@types/babel__traverse": "^7.0.6" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/babel-preset-current-node-syntax": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz", + "integrity": "sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==", + "dev": true, + "dependencies": { + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-bigint": "^7.8.3", + "@babel/plugin-syntax-class-properties": "^7.8.3", + "@babel/plugin-syntax-import-meta": "^7.8.3", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.8.3", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-top-level-await": "^7.8.3" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/babel-preset-jest": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.5.0.tgz", + "integrity": "sha512-JOMloxOqdiBSxMAzjRaH023/vvcaSaec49zvg+2LmNsktC7ei39LTJGw02J+9uUtTZUq6xbLyJ4dxe9sSmIuAg==", + "dev": true, + "dependencies": { + "babel-plugin-jest-hoist": "^29.5.0", + "babel-preset-current-node-syntax": "^1.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browserslist": { + "version": "4.21.9", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.9.tgz", + "integrity": "sha512-M0MFoZzbUrRU4KNfCrDLnvyE7gub+peetoTid3TBIqtunaDJyXlwhakT+/VkvSXcfIzFfK/nkCs4nmyTmxdNSg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "caniuse-lite": "^1.0.30001503", + "electron-to-chromium": "^1.4.431", + "node-releases": "^2.0.12", + "update-browserslist-db": "^1.0.11" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/bser": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", + "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", + "dev": true, + "dependencies": { + "node-int64": "^0.4.0" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001515", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001515.tgz", + "integrity": "sha512-eEFDwUOZbE24sb+Ecsx3+OvNETqjWIdabMy52oOkIgcUtAsQifjUG9q4U9dgTHJM2mfk4uEPxc0+xuFdJ629QA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ] + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/char-regex": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", + "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/ci-info": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.8.0.tgz", + "integrity": "sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "engines": { + "node": ">=8" + } + }, + "node_modules/cjs-module-lexer": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.3.tgz", + "integrity": "sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ==", + "dev": true + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", + "dev": true, + "engines": { + "iojs": ">= 1.0.0", + "node": ">= 0.12.0" + } + }, + "node_modules/collect-v8-coverage": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz", + "integrity": "sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==", + "dev": true + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/dedent": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", + "integrity": "sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA==", + "dev": true + }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/detect-newline": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", + "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/diff-sequences": { + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.4.3.tgz", + "integrity": "sha512-ofrBgwpPhCD85kMKtE9RYFFq6OC1A89oW2vvgWZNCwxrUpRUILopY7lsYyMDSjc8g6U6aiO0Qubg6r4Wgt5ZnA==", + "dev": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.4.457", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.457.tgz", + "integrity": "sha512-/g3UyNDmDd6ebeWapmAoiyy+Sy2HyJ+/X8KyvNeHfKRFfHaA2W8oF5fxD5F3tjBDcjpwo0iek6YNgxNXDBoEtA==", + "dev": true + }, + "node_modules/emittery": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.13.1.tgz", + "integrity": "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sindresorhus/emittery?sponsor=1" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/expect": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/expect/-/expect-29.6.1.tgz", + "integrity": "sha512-XEdDLonERCU1n9uR56/Stx9OqojaLAQtZf9PrCHH9Hl8YXiEIka3H4NXJ3NOIBmQJTg7+j7buh34PMHfJujc8g==", + "dev": true, + "dependencies": { + "@jest/expect-utils": "^29.6.1", + "@types/node": "*", + "jest-get-type": "^29.4.3", + "jest-matcher-utils": "^29.6.1", + "jest-message-util": "^29.6.1", + "jest-util": "^29.6.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/fb-watchman": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", + "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", + "dev": true, + "dependencies": { + "bser": "2.1.1" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "dev": true, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, + "node_modules/human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true, + "engines": { + "node": ">=10.17.0" + } + }, + "node_modules/import-local": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", + "integrity": "sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==", + "dev": true, + "dependencies": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/interpret": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", + "dev": true, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true + }, + "node_modules/is-core-module": { + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz", + "integrity": "sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-generator-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", + "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", + "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-instrument": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", + "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", + "dev": true, + "dependencies": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", + "dev": true, + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^3.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-source-maps": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", + "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", + "dev": true, + "dependencies": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-reports": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.5.tgz", + "integrity": "sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w==", + "dev": true, + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest/-/jest-29.6.1.tgz", + "integrity": "sha512-Nirw5B4nn69rVUZtemCQhwxOBhm0nsp3hmtF4rzCeWD7BkjAXRIji7xWQfnTNbz9g0aVsBX6aZK3n+23LM6uDw==", + "dev": true, + "dependencies": { + "@jest/core": "^29.6.1", + "@jest/types": "^29.6.1", + "import-local": "^3.0.2", + "jest-cli": "^29.6.1" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/jest-changed-files": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.5.0.tgz", + "integrity": "sha512-IFG34IUMUaNBIxjQXF/iu7g6EcdMrGRRxaUSw92I/2g2YC6vCdTltl4nHvt7Ci5nSJwXIkCu8Ka1DKF+X7Z1Ag==", + "dev": true, + "dependencies": { + "execa": "^5.0.0", + "p-limit": "^3.1.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-circus": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.6.1.tgz", + "integrity": "sha512-tPbYLEiBU4MYAL2XoZme/bgfUeotpDBd81lgHLCbDZZFaGmECk0b+/xejPFtmiBP87GgP/y4jplcRpbH+fgCzQ==", + "dev": true, + "dependencies": { + "@jest/environment": "^29.6.1", + "@jest/expect": "^29.6.1", + "@jest/test-result": "^29.6.1", + "@jest/types": "^29.6.1", + "@types/node": "*", + "chalk": "^4.0.0", + "co": "^4.6.0", + "dedent": "^0.7.0", + "is-generator-fn": "^2.0.0", + "jest-each": "^29.6.1", + "jest-matcher-utils": "^29.6.1", + "jest-message-util": "^29.6.1", + "jest-runtime": "^29.6.1", + "jest-snapshot": "^29.6.1", + "jest-util": "^29.6.1", + "p-limit": "^3.1.0", + "pretty-format": "^29.6.1", + "pure-rand": "^6.0.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-cli": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.6.1.tgz", + "integrity": "sha512-607dSgTA4ODIN6go9w6xY3EYkyPFGicx51a69H7yfvt7lN53xNswEVLovq+E77VsTRi5fWprLH0yl4DJgE8Ing==", + "dev": true, + "dependencies": { + "@jest/core": "^29.6.1", + "@jest/test-result": "^29.6.1", + "@jest/types": "^29.6.1", + "chalk": "^4.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "import-local": "^3.0.2", + "jest-config": "^29.6.1", + "jest-util": "^29.6.1", + "jest-validate": "^29.6.1", + "prompts": "^2.0.1", + "yargs": "^17.3.1" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/jest-config": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.6.1.tgz", + "integrity": "sha512-XdjYV2fy2xYixUiV2Wc54t3Z4oxYPAELUzWnV6+mcbq0rh742X2p52pii5A3oeRzYjLnQxCsZmp0qpI6klE2cQ==", + "dev": true, + "dependencies": { + "@babel/core": "^7.11.6", + "@jest/test-sequencer": "^29.6.1", + "@jest/types": "^29.6.1", + "babel-jest": "^29.6.1", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "deepmerge": "^4.2.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-circus": "^29.6.1", + "jest-environment-node": "^29.6.1", + "jest-get-type": "^29.4.3", + "jest-regex-util": "^29.4.3", + "jest-resolve": "^29.6.1", + "jest-runner": "^29.6.1", + "jest-util": "^29.6.1", + "jest-validate": "^29.6.1", + "micromatch": "^4.0.4", + "parse-json": "^5.2.0", + "pretty-format": "^29.6.1", + "slash": "^3.0.0", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@types/node": "*", + "ts-node": ">=9.0.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "ts-node": { + "optional": true + } + } + }, + "node_modules/jest-diff": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.6.1.tgz", + "integrity": "sha512-FsNCvinvl8oVxpNLttNQX7FAq7vR+gMDGj90tiP7siWw1UdakWUGqrylpsYrpvj908IYckm5Y0Q7azNAozU1Kg==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^29.4.3", + "jest-get-type": "^29.4.3", + "pretty-format": "^29.6.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-docblock": { + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.4.3.tgz", + "integrity": "sha512-fzdTftThczeSD9nZ3fzA/4KkHtnmllawWrXO69vtI+L9WjEIuXWs4AmyME7lN5hU7dB0sHhuPfcKofRsUb/2Fg==", + "dev": true, + "dependencies": { + "detect-newline": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-each": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.6.1.tgz", + "integrity": "sha512-n5eoj5eiTHpKQCAVcNTT7DRqeUmJ01hsAL0Q1SMiBHcBcvTKDELixQOGMCpqhbIuTcfC4kMfSnpmDqRgRJcLNQ==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.1", + "chalk": "^4.0.0", + "jest-get-type": "^29.4.3", + "jest-util": "^29.6.1", + "pretty-format": "^29.6.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-environment-node": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.6.1.tgz", + "integrity": "sha512-ZNIfAiE+foBog24W+2caIldl4Irh8Lx1PUhg/GZ0odM1d/h2qORAsejiFc7zb+SEmYPn1yDZzEDSU5PmDkmVLQ==", + "dev": true, + "dependencies": { + "@jest/environment": "^29.6.1", + "@jest/fake-timers": "^29.6.1", + "@jest/types": "^29.6.1", + "@types/node": "*", + "jest-mock": "^29.6.1", + "jest-util": "^29.6.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-get-type": { + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.4.3.tgz", + "integrity": "sha512-J5Xez4nRRMjk8emnTpWrlkyb9pfRQQanDrvWHhsR1+VUfbwxi30eVcZFlcdGInRibU4G5LwHXpI7IRHU0CY+gg==", + "dev": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-haste-map": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.6.1.tgz", + "integrity": "sha512-0m7f9PZXxOCk1gRACiVgX85knUKPKLPg4oRCjLoqIm9brTHXaorMA0JpmtmVkQiT8nmXyIVoZd/nnH1cfC33ig==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.1", + "@types/graceful-fs": "^4.1.3", + "@types/node": "*", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "graceful-fs": "^4.2.9", + "jest-regex-util": "^29.4.3", + "jest-util": "^29.6.1", + "jest-worker": "^29.6.1", + "micromatch": "^4.0.4", + "walker": "^1.0.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "optionalDependencies": { + "fsevents": "^2.3.2" + } + }, + "node_modules/jest-leak-detector": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.6.1.tgz", + "integrity": "sha512-OrxMNyZirpOEwkF3UHnIkAiZbtkBWiye+hhBweCHkVbCgyEy71Mwbb5zgeTNYWJBi1qgDVfPC1IwO9dVEeTLwQ==", + "dev": true, + "dependencies": { + "jest-get-type": "^29.4.3", + "pretty-format": "^29.6.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-matcher-utils": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.6.1.tgz", + "integrity": "sha512-SLaztw9d2mfQQKHmJXKM0HCbl2PPVld/t9Xa6P9sgiExijviSp7TnZZpw2Fpt+OI3nwUO/slJbOfzfUMKKC5QA==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^29.6.1", + "jest-get-type": "^29.4.3", + "pretty-format": "^29.6.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-message-util": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.6.1.tgz", + "integrity": "sha512-KoAW2zAmNSd3Gk88uJ56qXUWbFk787QKmjjJVOjtGFmmGSZgDBrlIL4AfQw1xyMYPNVD7dNInfIbur9B2rd/wQ==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.12.13", + "@jest/types": "^29.6.1", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "micromatch": "^4.0.4", + "pretty-format": "^29.6.1", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-mock": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.6.1.tgz", + "integrity": "sha512-brovyV9HBkjXAEdRooaTQK42n8usKoSRR3gihzUpYeV/vwqgSoNfrksO7UfSACnPmxasO/8TmHM3w9Hp3G1dgw==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.1", + "@types/node": "*", + "jest-util": "^29.6.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-pnp-resolver": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", + "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", + "dev": true, + "engines": { + "node": ">=6" + }, + "peerDependencies": { + "jest-resolve": "*" + }, + "peerDependenciesMeta": { + "jest-resolve": { + "optional": true + } + } + }, + "node_modules/jest-regex-util": { + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.4.3.tgz", + "integrity": "sha512-O4FglZaMmWXbGHSQInfXewIsd1LMn9p3ZXB/6r4FOkyhX2/iP/soMG98jGvk/A3HAN78+5VWcBGO0BJAPRh4kg==", + "dev": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-resolve": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.6.1.tgz", + "integrity": "sha512-AeRkyS8g37UyJiP9w3mmI/VXU/q8l/IH52vj/cDAyScDcemRbSBhfX/NMYIGilQgSVwsjxrCHf3XJu4f+lxCMg==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.6.1", + "jest-pnp-resolver": "^1.2.2", + "jest-util": "^29.6.1", + "jest-validate": "^29.6.1", + "resolve": "^1.20.0", + "resolve.exports": "^2.0.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-resolve-dependencies": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.6.1.tgz", + "integrity": "sha512-BbFvxLXtcldaFOhNMXmHRWx1nXQO5LoXiKSGQcA1LxxirYceZT6ch8KTE1bK3X31TNG/JbkI7OkS/ABexVahiw==", + "dev": true, + "dependencies": { + "jest-regex-util": "^29.4.3", + "jest-snapshot": "^29.6.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-runner": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.6.1.tgz", + "integrity": "sha512-tw0wb2Q9yhjAQ2w8rHRDxteryyIck7gIzQE4Reu3JuOBpGp96xWgF0nY8MDdejzrLCZKDcp8JlZrBN/EtkQvPQ==", + "dev": true, + "dependencies": { + "@jest/console": "^29.6.1", + "@jest/environment": "^29.6.1", + "@jest/test-result": "^29.6.1", + "@jest/transform": "^29.6.1", + "@jest/types": "^29.6.1", + "@types/node": "*", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "graceful-fs": "^4.2.9", + "jest-docblock": "^29.4.3", + "jest-environment-node": "^29.6.1", + "jest-haste-map": "^29.6.1", + "jest-leak-detector": "^29.6.1", + "jest-message-util": "^29.6.1", + "jest-resolve": "^29.6.1", + "jest-runtime": "^29.6.1", + "jest-util": "^29.6.1", + "jest-watcher": "^29.6.1", + "jest-worker": "^29.6.1", + "p-limit": "^3.1.0", + "source-map-support": "0.5.13" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-runtime": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.6.1.tgz", + "integrity": "sha512-D6/AYOA+Lhs5e5il8+5pSLemjtJezUr+8zx+Sn8xlmOux3XOqx4d8l/2udBea8CRPqqrzhsKUsN/gBDE/IcaPQ==", + "dev": true, + "dependencies": { + "@jest/environment": "^29.6.1", + "@jest/fake-timers": "^29.6.1", + "@jest/globals": "^29.6.1", + "@jest/source-map": "^29.6.0", + "@jest/test-result": "^29.6.1", + "@jest/transform": "^29.6.1", + "@jest/types": "^29.6.1", + "@types/node": "*", + "chalk": "^4.0.0", + "cjs-module-lexer": "^1.0.0", + "collect-v8-coverage": "^1.0.0", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.6.1", + "jest-message-util": "^29.6.1", + "jest-mock": "^29.6.1", + "jest-regex-util": "^29.4.3", + "jest-resolve": "^29.6.1", + "jest-snapshot": "^29.6.1", + "jest-util": "^29.6.1", + "slash": "^3.0.0", + "strip-bom": "^4.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-snapshot": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.6.1.tgz", + "integrity": "sha512-G4UQE1QQ6OaCgfY+A0uR1W2AY0tGXUPQpoUClhWHq1Xdnx1H6JOrC2nH5lqnOEqaDgbHFgIwZ7bNq24HpB180A==", + "dev": true, + "dependencies": { + "@babel/core": "^7.11.6", + "@babel/generator": "^7.7.2", + "@babel/plugin-syntax-jsx": "^7.7.2", + "@babel/plugin-syntax-typescript": "^7.7.2", + "@babel/types": "^7.3.3", + "@jest/expect-utils": "^29.6.1", + "@jest/transform": "^29.6.1", + "@jest/types": "^29.6.1", + "@types/prettier": "^2.1.5", + "babel-preset-current-node-syntax": "^1.0.0", + "chalk": "^4.0.0", + "expect": "^29.6.1", + "graceful-fs": "^4.2.9", + "jest-diff": "^29.6.1", + "jest-get-type": "^29.4.3", + "jest-matcher-utils": "^29.6.1", + "jest-message-util": "^29.6.1", + "jest-util": "^29.6.1", + "natural-compare": "^1.4.0", + "pretty-format": "^29.6.1", + "semver": "^7.5.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-snapshot/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jest-snapshot/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jest-snapshot/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/jest-util": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.6.1.tgz", + "integrity": "sha512-NRFCcjc+/uO3ijUVyNOQJluf8PtGCe/W6cix36+M3cTFgiYqFOOW5MgN4JOOcvbUhcKTYVd1CvHz/LWi8d16Mg==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.1", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-validate": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.6.1.tgz", + "integrity": "sha512-r3Ds69/0KCN4vx4sYAbGL1EVpZ7MSS0vLmd3gV78O+NAx3PDQQukRU5hNHPXlyqCgFY8XUk7EuTMLugh0KzahA==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.1", + "camelcase": "^6.2.0", + "chalk": "^4.0.0", + "jest-get-type": "^29.4.3", + "leven": "^3.1.0", + "pretty-format": "^29.6.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-validate/node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/jest-watcher": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.6.1.tgz", + "integrity": "sha512-d4wpjWTS7HEZPaaj8m36QiaP856JthRZkrgcIY/7ISoUWPIillrXM23WPboZVLbiwZBt4/qn2Jke84Sla6JhFA==", + "dev": true, + "dependencies": { + "@jest/test-result": "^29.6.1", + "@jest/types": "^29.6.1", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "jest-util": "^29.6.1", + "string-length": "^4.0.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-worker": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.6.1.tgz", + "integrity": "sha512-U+Wrbca7S8ZAxAe9L6nb6g8kPdia5hj32Puu5iOqBCMTMWFHXuK6dOV2IFrpedbTV8fjMFLdWNttQTBL6u2MRA==", + "dev": true, + "dependencies": { + "@types/node": "*", + "jest-util": "^29.6.1", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-worker/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true, + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/leven": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true + }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/makeerror": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", + "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", + "dev": true, + "dependencies": { + "tmpl": "1.0.5" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, + "node_modules/node-int64": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", + "dev": true + }, + "node_modules/node-releases": { + "version": "2.0.13", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", + "integrity": "sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==", + "dev": true + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-locate/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pirates": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", + "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pretty-format": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.6.1.tgz", + "integrity": "sha512-7jRj+yXO0W7e4/tSJKoR7HRIHLPPjtNaUGG2xxKQnGvPNRkgWcQ0AZX6P4KBRJN4FcTBWb3sa7DVUJmocYuoog==", + "dev": true, + "dependencies": { + "@jest/schemas": "^29.6.0", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/prompts": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", + "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", + "dev": true, + "dependencies": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/pure-rand": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.0.2.tgz", + "integrity": "sha512-6Yg0ekpKICSjPswYOuC5sku/TSWaRYlA0qsXqJgM/d/4pLPHPuTxK7Nbf7jFKzAeedUhR8C7K9Uv63FBsSo8xQ==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/dubzzz" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + ] + }, + "node_modules/react-is": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", + "dev": true + }, + "node_modules/rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", + "dev": true, + "dependencies": { + "resolve": "^1.1.6" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve": { + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", + "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", + "dev": true, + "dependencies": { + "is-core-module": "^2.11.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "dev": true, + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve.exports": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", + "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/shelljs": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", + "dev": true, + "dependencies": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + }, + "bin": { + "shjs": "bin/shjs" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/shx": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/shx/-/shx-0.3.4.tgz", + "integrity": "sha512-N6A9MLVqjxZYcVn8hLmtneQWIJtp8IKzMP4eMnx+nqkvXoqinUPCbUFLp2UcWTEIUONhlk0ewxr/jaVGlc+J+g==", + "dev": true, + "dependencies": { + "minimist": "^1.2.3", + "shelljs": "^0.8.5" + }, + "bin": { + "shx": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/sigmajs-crypto-facade": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/sigmajs-crypto-facade/-/sigmajs-crypto-facade-0.0.6.tgz", + "integrity": "sha512-Nbz+CZ0rgMvDN76C3bQjrFHO30qSHE9Fti+Co4WvNzL9UTaxSOlfSFJy89u0QX+IkVNvXd35RqiyiekLpTUSsA==", + "dependencies": { + "@noble/hashes": "^1.1.4" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "node_modules/sisteransi": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", + "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", + "dev": true + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.13", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", + "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", + "dev": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true + }, + "node_modules/stack-utils": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", + "dev": true, + "dependencies": { + "escape-string-regexp": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/string-length": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", + "integrity": "sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==", + "dev": true, + "dependencies": { + "char-regex": "^1.0.2", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", + "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/tmpl": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", + "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", + "dev": true + }, + "node_modules/to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz", + "integrity": "sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "escalade": "^3.1.1", + "picocolors": "^1.0.0" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/v8-to-istanbul": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.0.tgz", + "integrity": "sha512-6z3GW9x8G1gd+JIIgQQQxXuiJtCXeAjp6RaPEPLv62mH3iPHPxV6W3robxtCzNErRo6ZwTmzWhsbNvjyEBKzKA==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^1.6.0" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/v8-to-istanbul/node_modules/convert-source-map": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", + "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", + "dev": true + }, + "node_modules/walker": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", + "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", + "dev": true, + "dependencies": { + "makeerror": "1.0.12" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "node_modules/write-file-atomic": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", + "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", + "dev": true, + "dependencies": { + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.7" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + }, + "dependencies": { + "@ampproject/remapping": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", + "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==", + "dev": true, + "requires": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "@babel/code-frame": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.5.tgz", + "integrity": "sha512-Xmwn266vad+6DAqEB2A6V/CcZVp62BbwVmcOJc2RPuwih1kw02TjQvWVWlcKGbBPd+8/0V5DEkOcizRGYsspYQ==", + "dev": true, + "requires": { + "@babel/highlight": "^7.22.5" + } + }, + "@babel/compat-data": { + "version": "7.22.9", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.22.9.tgz", + "integrity": "sha512-5UamI7xkUcJ3i9qVDS+KFDEK8/7oJ55/sJMB1Ge7IEapr7KfdfV/HErR+koZwOfd+SgtFKOKRhRakdg++DcJpQ==", + "dev": true + }, + "@babel/core": { + "version": "7.22.9", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.22.9.tgz", + "integrity": "sha512-G2EgeufBcYw27U4hhoIwFcgc1XU7TlXJ3mv04oOv1WCuo900U/anZSPzEqNjwdjgffkk2Gs0AN0dW1CKVLcG7w==", + "dev": true, + "requires": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.22.5", + "@babel/generator": "^7.22.9", + "@babel/helper-compilation-targets": "^7.22.9", + "@babel/helper-module-transforms": "^7.22.9", + "@babel/helpers": "^7.22.6", + "@babel/parser": "^7.22.7", + "@babel/template": "^7.22.5", + "@babel/traverse": "^7.22.8", + "@babel/types": "^7.22.5", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.2", + "semver": "^6.3.1" + }, + "dependencies": { + "convert-source-map": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", + "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", + "dev": true + } + } + }, + "@babel/generator": { + "version": "7.22.9", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.22.9.tgz", + "integrity": "sha512-KtLMbmicyuK2Ak/FTCJVbDnkN1SlT8/kceFTiuDiiRUUSMnHMidxSCdG4ndkTOHHpoomWe/4xkvHkEOncwjYIw==", + "dev": true, + "requires": { + "@babel/types": "^7.22.5", + "@jridgewell/gen-mapping": "^0.3.2", + "@jridgewell/trace-mapping": "^0.3.17", + "jsesc": "^2.5.1" + } + }, + "@babel/helper-compilation-targets": { + "version": "7.22.9", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.9.tgz", + "integrity": "sha512-7qYrNM6HjpnPHJbopxmb8hSPoZ0gsX8IvUS32JGVoy+pU9e5N0nLr1VjJoR6kA4d9dmGLxNYOjeB8sUDal2WMw==", + "dev": true, + "requires": { + "@babel/compat-data": "^7.22.9", + "@babel/helper-validator-option": "^7.22.5", + "browserslist": "^4.21.9", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + } + }, + "@babel/helper-environment-visitor": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.5.tgz", + "integrity": "sha512-XGmhECfVA/5sAt+H+xpSg0mfrHq6FzNr9Oxh7PSEBBRUb/mL7Kz3NICXb194rCqAEdxkhPT1a88teizAFyvk8Q==", + "dev": true + }, + "@babel/helper-function-name": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.22.5.tgz", + "integrity": "sha512-wtHSq6jMRE3uF2otvfuD3DIvVhOsSNshQl0Qrd7qC9oQJzHvOL4qQXlQn2916+CXGywIjpGuIkoyZRRxHPiNQQ==", + "dev": true, + "requires": { + "@babel/template": "^7.22.5", + "@babel/types": "^7.22.5" + } + }, + "@babel/helper-hoist-variables": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", + "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", + "dev": true, + "requires": { + "@babel/types": "^7.22.5" + } + }, + "@babel/helper-module-imports": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.22.5.tgz", + "integrity": "sha512-8Dl6+HD/cKifutF5qGd/8ZJi84QeAKh+CEe1sBzz8UayBBGg1dAIJrdHOcOM5b2MpzWL2yuotJTtGjETq0qjXg==", + "dev": true, + "requires": { + "@babel/types": "^7.22.5" + } + }, + "@babel/helper-module-transforms": { + "version": "7.22.9", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.22.9.tgz", + "integrity": "sha512-t+WA2Xn5K+rTeGtC8jCsdAH52bjggG5TKRuRrAGNM/mjIbO4GxvlLMFOEz9wXY5I2XQ60PMFsAG2WIcG82dQMQ==", + "dev": true, + "requires": { + "@babel/helper-environment-visitor": "^7.22.5", + "@babel/helper-module-imports": "^7.22.5", + "@babel/helper-simple-access": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/helper-validator-identifier": "^7.22.5" + } + }, + "@babel/helper-plugin-utils": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz", + "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==", + "dev": true + }, + "@babel/helper-simple-access": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz", + "integrity": "sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==", + "dev": true, + "requires": { + "@babel/types": "^7.22.5" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", + "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", + "dev": true, + "requires": { + "@babel/types": "^7.22.5" + } + }, + "@babel/helper-string-parser": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz", + "integrity": "sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==", + "dev": true + }, + "@babel/helper-validator-identifier": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.5.tgz", + "integrity": "sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ==", + "dev": true + }, + "@babel/helper-validator-option": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.22.5.tgz", + "integrity": "sha512-R3oB6xlIVKUnxNUxbmgq7pKjxpru24zlimpE8WK47fACIlM0II/Hm1RS8IaOI7NgCr6LNS+jl5l75m20npAziw==", + "dev": true + }, + "@babel/helpers": { + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.22.6.tgz", + "integrity": "sha512-YjDs6y/fVOYFV8hAf1rxd1QvR9wJe1pDBZ2AREKq/SDayfPzgk0PBnVuTCE5X1acEpMMNOVUqoe+OwiZGJ+OaA==", + "dev": true, + "requires": { + "@babel/template": "^7.22.5", + "@babel/traverse": "^7.22.6", + "@babel/types": "^7.22.5" + } + }, + "@babel/highlight": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.5.tgz", + "integrity": "sha512-BSKlD1hgnedS5XRnGOljZawtag7H1yPfQp0tdNJCHoH6AZ+Pcm9VvkrK59/Yy593Ypg0zMxH2BxD1VPYUQ7UIw==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.22.5", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "@babel/parser": { + "version": "7.22.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.7.tgz", + "integrity": "sha512-7NF8pOkHP5o2vpmGgNGcfAeCvOYhGLyA3Z4eBQkT1RJlWu47n63bCs93QfJ2hIAFCil7L5P2IWhs1oToVgrL0Q==", + "dev": true + }, + "@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", + "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-bigint": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", + "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", + "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-syntax-import-meta": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", + "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", + "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-jsx": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.22.5.tgz", + "integrity": "sha512-gvyP4hZrgrs/wWMaocvxZ44Hw0b3W8Pe+cMxc8V1ULQ07oh8VNbIRaoD1LRZVTvD+0nieDKjfgKg89sD7rrKrg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.22.5" + } + }, + "@babel/plugin-syntax-logical-assignment-operators": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", + "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", + "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-numeric-separator": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", + "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-optional-catch-binding": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", + "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", + "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-top-level-await": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", + "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-syntax-typescript": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.22.5.tgz", + "integrity": "sha512-1mS2o03i7t1c6VzH6fdQ3OA8tcEIxwG18zIPRp+UY1Ihv6W+XZzBCVxExF9upussPXJ0xE9XRHwMoNs1ep/nRQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.22.5" + } + }, + "@babel/template": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.5.tgz", + "integrity": "sha512-X7yV7eiwAxdj9k94NEylvbVHLiVG1nvzCV2EAowhxLTwODV1jl9UzZ48leOC0sH7OnuHrIkllaBgneUykIcZaw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.22.5", + "@babel/parser": "^7.22.5", + "@babel/types": "^7.22.5" + } + }, + "@babel/traverse": { + "version": "7.22.8", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.22.8.tgz", + "integrity": "sha512-y6LPR+wpM2I3qJrsheCTwhIinzkETbplIgPBbwvqPKc+uljeA5gP+3nP8irdYt1mjQaDnlIcG+dw8OjAco4GXw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.22.5", + "@babel/generator": "^7.22.7", + "@babel/helper-environment-visitor": "^7.22.5", + "@babel/helper-function-name": "^7.22.5", + "@babel/helper-hoist-variables": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/parser": "^7.22.7", + "@babel/types": "^7.22.5", + "debug": "^4.1.0", + "globals": "^11.1.0" + } + }, + "@babel/types": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.22.5.tgz", + "integrity": "sha512-zo3MIHGOkPOfoRXitsgHLjEXmlDaD/5KU1Uzuc9GNiZPhSqVxVRtxuPaSBZDsYZ9qV88AjtMtWW7ww98loJ9KA==", + "dev": true, + "requires": { + "@babel/helper-string-parser": "^7.22.5", + "@babel/helper-validator-identifier": "^7.22.5", + "to-fast-properties": "^2.0.0" + } + }, + "@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true + }, + "@fleet-sdk/common": { + "version": "0.1.0-alpha.14", + "resolved": "https://registry.npmjs.org/@fleet-sdk/common/-/common-0.1.0-alpha.14.tgz", + "integrity": "sha512-w6AMHe77FaSb759e3EwcOVRQ/lEsCdr1pXq376B+T80do5pUcWjrlrIEKKNrEJPCyqW8nNClxIqBVqkFuPbbMw==" + }, + "@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", + "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", + "dev": true, + "requires": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + } + }, + "@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true + }, + "@jest/console": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.6.1.tgz", + "integrity": "sha512-Aj772AYgwTSr5w8qnyoJ0eDYvN6bMsH3ORH1ivMotrInHLKdUz6BDlaEXHdM6kODaBIkNIyQGzsMvRdOv7VG7Q==", + "dev": true, + "requires": { + "@jest/types": "^29.6.1", + "@types/node": "*", + "chalk": "^4.0.0", + "jest-message-util": "^29.6.1", + "jest-util": "^29.6.1", + "slash": "^3.0.0" + } + }, + "@jest/core": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.6.1.tgz", + "integrity": "sha512-CcowHypRSm5oYQ1obz1wfvkjZZ2qoQlrKKvlfPwh5jUXVU12TWr2qMeH8chLMuTFzHh5a1g2yaqlqDICbr+ukQ==", + "dev": true, + "requires": { + "@jest/console": "^29.6.1", + "@jest/reporters": "^29.6.1", + "@jest/test-result": "^29.6.1", + "@jest/transform": "^29.6.1", + "@jest/types": "^29.6.1", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-changed-files": "^29.5.0", + "jest-config": "^29.6.1", + "jest-haste-map": "^29.6.1", + "jest-message-util": "^29.6.1", + "jest-regex-util": "^29.4.3", + "jest-resolve": "^29.6.1", + "jest-resolve-dependencies": "^29.6.1", + "jest-runner": "^29.6.1", + "jest-runtime": "^29.6.1", + "jest-snapshot": "^29.6.1", + "jest-util": "^29.6.1", + "jest-validate": "^29.6.1", + "jest-watcher": "^29.6.1", + "micromatch": "^4.0.4", + "pretty-format": "^29.6.1", + "slash": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "@jest/environment": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.6.1.tgz", + "integrity": "sha512-RMMXx4ws+Gbvw3DfLSuo2cfQlK7IwGbpuEWXCqyYDcqYTI+9Ju3a5hDnXaxjNsa6uKh9PQF2v+qg+RLe63tz5A==", + "dev": true, + "requires": { + "@jest/fake-timers": "^29.6.1", + "@jest/types": "^29.6.1", + "@types/node": "*", + "jest-mock": "^29.6.1" + } + }, + "@jest/expect": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.6.1.tgz", + "integrity": "sha512-N5xlPrAYaRNyFgVf2s9Uyyvr795jnB6rObuPx4QFvNJz8aAjpZUDfO4bh5G/xuplMID8PrnuF1+SfSyDxhsgYg==", + "dev": true, + "requires": { + "expect": "^29.6.1", + "jest-snapshot": "^29.6.1" + } + }, + "@jest/expect-utils": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.6.1.tgz", + "integrity": "sha512-o319vIf5pEMx0LmzSxxkYYxo4wrRLKHq9dP1yJU7FoPTB0LfAKSz8SWD6D/6U3v/O52t9cF5t+MeJiRsfk7zMw==", + "dev": true, + "requires": { + "jest-get-type": "^29.4.3" + } + }, + "@jest/fake-timers": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.6.1.tgz", + "integrity": "sha512-RdgHgbXyosCDMVYmj7lLpUwXA4c69vcNzhrt69dJJdf8azUrpRh3ckFCaTPNjsEeRi27Cig0oKDGxy5j7hOgHg==", + "dev": true, + "requires": { + "@jest/types": "^29.6.1", + "@sinonjs/fake-timers": "^10.0.2", + "@types/node": "*", + "jest-message-util": "^29.6.1", + "jest-mock": "^29.6.1", + "jest-util": "^29.6.1" + } + }, + "@jest/globals": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.6.1.tgz", + "integrity": "sha512-2VjpaGy78JY9n9370H8zGRCFbYVWwjY6RdDMhoJHa1sYfwe6XM/azGN0SjY8kk7BOZApIejQ1BFPyH7FPG0w3A==", + "dev": true, + "requires": { + "@jest/environment": "^29.6.1", + "@jest/expect": "^29.6.1", + "@jest/types": "^29.6.1", + "jest-mock": "^29.6.1" + } + }, + "@jest/reporters": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.6.1.tgz", + "integrity": "sha512-9zuaI9QKr9JnoZtFQlw4GREQbxgmNYXU6QuWtmuODvk5nvPUeBYapVR/VYMyi2WSx3jXTLJTJji8rN6+Cm4+FA==", + "dev": true, + "requires": { + "@bcoe/v8-coverage": "^0.2.3", + "@jest/console": "^29.6.1", + "@jest/test-result": "^29.6.1", + "@jest/transform": "^29.6.1", + "@jest/types": "^29.6.1", + "@jridgewell/trace-mapping": "^0.3.18", + "@types/node": "*", + "chalk": "^4.0.0", + "collect-v8-coverage": "^1.0.0", + "exit": "^0.1.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-instrument": "^5.1.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.1.3", + "jest-message-util": "^29.6.1", + "jest-util": "^29.6.1", + "jest-worker": "^29.6.1", + "slash": "^3.0.0", + "string-length": "^4.0.1", + "strip-ansi": "^6.0.0", + "v8-to-istanbul": "^9.0.1" + } + }, + "@jest/schemas": { + "version": "29.6.0", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.0.tgz", + "integrity": "sha512-rxLjXyJBTL4LQeJW3aKo0M/+GkCOXsO+8i9Iu7eDb6KwtP65ayoDsitrdPBtujxQ88k4wI2FNYfa6TOGwSn6cQ==", + "dev": true, + "requires": { + "@sinclair/typebox": "^0.27.8" + } + }, + "@jest/source-map": { + "version": "29.6.0", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.6.0.tgz", + "integrity": "sha512-oA+I2SHHQGxDCZpbrsCQSoMLb3Bz547JnM+jUr9qEbuw0vQlWZfpPS7CO9J7XiwKicEz9OFn/IYoLkkiUD7bzA==", + "dev": true, + "requires": { + "@jridgewell/trace-mapping": "^0.3.18", + "callsites": "^3.0.0", + "graceful-fs": "^4.2.9" + } + }, + "@jest/test-result": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.6.1.tgz", + "integrity": "sha512-Ynr13ZRcpX6INak0TPUukU8GWRfm/vAytE3JbJNGAvINySWYdfE7dGZMbk36oVuK4CigpbhMn8eg1dixZ7ZJOw==", + "dev": true, + "requires": { + "@jest/console": "^29.6.1", + "@jest/types": "^29.6.1", + "@types/istanbul-lib-coverage": "^2.0.0", + "collect-v8-coverage": "^1.0.0" + } + }, + "@jest/test-sequencer": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.6.1.tgz", + "integrity": "sha512-oBkC36PCDf/wb6dWeQIhaviU0l5u6VCsXa119yqdUosYAt7/FbQU2M2UoziO3igj/HBDEgp57ONQ3fm0v9uyyg==", + "dev": true, + "requires": { + "@jest/test-result": "^29.6.1", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.6.1", + "slash": "^3.0.0" + } + }, + "@jest/transform": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.6.1.tgz", + "integrity": "sha512-URnTneIU3ZjRSaf906cvf6Hpox3hIeJXRnz3VDSw5/X93gR8ycdfSIEy19FlVx8NFmpN7fe3Gb1xF+NjXaQLWg==", + "dev": true, + "requires": { + "@babel/core": "^7.11.6", + "@jest/types": "^29.6.1", + "@jridgewell/trace-mapping": "^0.3.18", + "babel-plugin-istanbul": "^6.1.1", + "chalk": "^4.0.0", + "convert-source-map": "^2.0.0", + "fast-json-stable-stringify": "^2.1.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.6.1", + "jest-regex-util": "^29.4.3", + "jest-util": "^29.6.1", + "micromatch": "^4.0.4", + "pirates": "^4.0.4", + "slash": "^3.0.0", + "write-file-atomic": "^4.0.2" + } + }, + "@jest/types": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.1.tgz", + "integrity": "sha512-tPKQNMPuXgvdOn2/Lg9HNfUvjYVGolt04Hp03f5hAk878uwOLikN+JzeLY0HcVgKgFl9Hs3EIqpu3WX27XNhnw==", + "dev": true, + "requires": { + "@jest/schemas": "^29.6.0", + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^17.0.8", + "chalk": "^4.0.0" + } + }, + "@jridgewell/gen-mapping": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", + "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "dev": true, + "requires": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "@jridgewell/resolve-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", + "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "dev": true + }, + "@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "dev": true + }, + "@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "@jridgewell/trace-mapping": { + "version": "0.3.18", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz", + "integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "3.1.0", + "@jridgewell/sourcemap-codec": "1.4.14" + }, + "dependencies": { + "@jridgewell/sourcemap-codec": { + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", + "dev": true + } + } + }, + "@noble/hashes": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.4.tgz", + "integrity": "sha512-+PYsVPrTSqtVjatKt2A/Proukn2Yrz61OBThOCKErc5w2/r1Fh37vbDv0Eah7pyNltrmacjwTvdw3JoR+WE4TA==" + }, + "@sinclair/typebox": { + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", + "dev": true + }, + "@sinonjs/commons": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.0.tgz", + "integrity": "sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA==", + "dev": true, + "requires": { + "type-detect": "4.0.8" + } + }, + "@sinonjs/fake-timers": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz", + "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==", + "dev": true, + "requires": { + "@sinonjs/commons": "^3.0.0" + } + }, + "@types/babel__core": { + "version": "7.20.1", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.1.tgz", + "integrity": "sha512-aACu/U/omhdk15O4Nfb+fHgH/z3QsfQzpnvRZhYhThms83ZnAOZz7zZAWO7mn2yyNQaA4xTO8GLK3uqFU4bYYw==", + "dev": true, + "requires": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "@types/babel__generator": { + "version": "7.6.4", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.4.tgz", + "integrity": "sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg==", + "dev": true, + "requires": { + "@babel/types": "^7.0.0" + } + }, + "@types/babel__template": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.1.tgz", + "integrity": "sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g==", + "dev": true, + "requires": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "@types/babel__traverse": { + "version": "7.20.1", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.1.tgz", + "integrity": "sha512-MitHFXnhtgwsGZWtT68URpOvLN4EREih1u3QtQiN4VdAxWKRVvGCSvw/Qth0M0Qq3pJpnGOu5JaM/ydK7OGbqg==", + "dev": true, + "requires": { + "@babel/types": "^7.20.7" + } + }, + "@types/graceful-fs": { + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.6.tgz", + "integrity": "sha512-Sig0SNORX9fdW+bQuTEovKj3uHcUL6LQKbCrrqb1X7J6/ReAbhCXRAhc+SMejhLELFj2QcyuxmUooZ4bt5ReSw==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/istanbul-lib-coverage": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", + "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", + "dev": true + }, + "@types/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "*" + } + }, + "@types/istanbul-reports": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", + "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", + "dev": true, + "requires": { + "@types/istanbul-lib-report": "*" + } + }, + "@types/node": { + "version": "20.4.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.1.tgz", + "integrity": "sha512-JIzsAvJeA/5iY6Y/OxZbv1lUcc8dNSE77lb2gnBH+/PJ3lFR1Ccvgwl5JWnHAkNHcRsT0TbpVOsiMKZ1F/yyJg==", + "dev": true + }, + "@types/prettier": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.3.tgz", + "integrity": "sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA==", + "dev": true + }, + "@types/stack-utils": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", + "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==", + "dev": true + }, + "@types/yargs": { + "version": "17.0.24", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.24.tgz", + "integrity": "sha512-6i0aC7jV6QzQB8ne1joVZ0eSFIstHsCrobmOtghM11yGlH0j43FKL2UhWdELkyps0zuf7qVTUVCCR+tgSlyLLw==", + "dev": true, + "requires": { + "@types/yargs-parser": "*" + } + }, + "@types/yargs-parser": { + "version": "21.0.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", + "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", + "dev": true + }, + "ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dev": true, + "requires": { + "type-fest": "^0.21.3" + } + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "babel-jest": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.6.1.tgz", + "integrity": "sha512-qu+3bdPEQC6KZSPz+4Fyjbga5OODNcp49j6GKzG1EKbkfyJBxEYGVUmVGpwCSeGouG52R4EgYMLb6p9YeEEQ4A==", + "dev": true, + "requires": { + "@jest/transform": "^29.6.1", + "@types/babel__core": "^7.1.14", + "babel-plugin-istanbul": "^6.1.1", + "babel-preset-jest": "^29.5.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "slash": "^3.0.0" + } + }, + "babel-plugin-istanbul": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", + "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-instrument": "^5.0.4", + "test-exclude": "^6.0.0" + } + }, + "babel-plugin-jest-hoist": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.5.0.tgz", + "integrity": "sha512-zSuuuAlTMT4mzLj2nPnUm6fsE6270vdOfnpbJ+RmruU75UhLFvL0N2NgI7xpeS7NaB6hGqmd5pVpGTDYvi4Q3w==", + "dev": true, + "requires": { + "@babel/template": "^7.3.3", + "@babel/types": "^7.3.3", + "@types/babel__core": "^7.1.14", + "@types/babel__traverse": "^7.0.6" + } + }, + "babel-preset-current-node-syntax": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz", + "integrity": "sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==", + "dev": true, + "requires": { + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-bigint": "^7.8.3", + "@babel/plugin-syntax-class-properties": "^7.8.3", + "@babel/plugin-syntax-import-meta": "^7.8.3", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.8.3", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-top-level-await": "^7.8.3" + } + }, + "babel-preset-jest": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.5.0.tgz", + "integrity": "sha512-JOMloxOqdiBSxMAzjRaH023/vvcaSaec49zvg+2LmNsktC7ei39LTJGw02J+9uUtTZUq6xbLyJ4dxe9sSmIuAg==", + "dev": true, + "requires": { + "babel-plugin-jest-hoist": "^29.5.0", + "babel-preset-current-node-syntax": "^1.0.0" + } + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "browserslist": { + "version": "4.21.9", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.9.tgz", + "integrity": "sha512-M0MFoZzbUrRU4KNfCrDLnvyE7gub+peetoTid3TBIqtunaDJyXlwhakT+/VkvSXcfIzFfK/nkCs4nmyTmxdNSg==", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30001503", + "electron-to-chromium": "^1.4.431", + "node-releases": "^2.0.12", + "update-browserslist-db": "^1.0.11" + } + }, + "bser": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", + "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", + "dev": true, + "requires": { + "node-int64": "^0.4.0" + } + }, + "buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, + "caniuse-lite": { + "version": "1.0.30001515", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001515.tgz", + "integrity": "sha512-eEFDwUOZbE24sb+Ecsx3+OvNETqjWIdabMy52oOkIgcUtAsQifjUG9q4U9dgTHJM2mfk4uEPxc0+xuFdJ629QA==", + "dev": true + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "char-regex": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", + "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", + "dev": true + }, + "ci-info": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.8.0.tgz", + "integrity": "sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw==", + "dev": true + }, + "cjs-module-lexer": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.3.tgz", + "integrity": "sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ==", + "dev": true + }, + "cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + } + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", + "dev": true + }, + "collect-v8-coverage": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz", + "integrity": "sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==", + "dev": true + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "dedent": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", + "integrity": "sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA==", + "dev": true + }, + "deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true + }, + "detect-newline": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", + "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", + "dev": true + }, + "diff-sequences": { + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.4.3.tgz", + "integrity": "sha512-ofrBgwpPhCD85kMKtE9RYFFq6OC1A89oW2vvgWZNCwxrUpRUILopY7lsYyMDSjc8g6U6aiO0Qubg6r4Wgt5ZnA==", + "dev": true + }, + "electron-to-chromium": { + "version": "1.4.457", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.457.tgz", + "integrity": "sha512-/g3UyNDmDd6ebeWapmAoiyy+Sy2HyJ+/X8KyvNeHfKRFfHaA2W8oF5fxD5F3tjBDcjpwo0iek6YNgxNXDBoEtA==", + "dev": true + }, + "emittery": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.13.1.tgz", + "integrity": "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true + }, + "escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + } + }, + "exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", + "dev": true + }, + "expect": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/expect/-/expect-29.6.1.tgz", + "integrity": "sha512-XEdDLonERCU1n9uR56/Stx9OqojaLAQtZf9PrCHH9Hl8YXiEIka3H4NXJ3NOIBmQJTg7+j7buh34PMHfJujc8g==", + "dev": true, + "requires": { + "@jest/expect-utils": "^29.6.1", + "@types/node": "*", + "jest-get-type": "^29.4.3", + "jest-matcher-utils": "^29.6.1", + "jest-message-util": "^29.6.1", + "jest-util": "^29.6.1" + } + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "fb-watchman": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", + "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", + "dev": true, + "requires": { + "bser": "2.1.1" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "optional": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, + "get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "dev": true + }, + "get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true + }, + "glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true + }, + "graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, + "human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true + }, + "import-local": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", + "integrity": "sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==", + "dev": true, + "requires": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "interpret": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", + "dev": true + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true + }, + "is-core-module": { + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz", + "integrity": "sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "is-generator-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", + "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", + "dev": true + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "istanbul-lib-coverage": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", + "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", + "dev": true + }, + "istanbul-lib-instrument": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", + "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", + "dev": true, + "requires": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + } + }, + "istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", + "dev": true, + "requires": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^3.0.0", + "supports-color": "^7.1.0" + } + }, + "istanbul-lib-source-maps": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", + "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + } + }, + "istanbul-reports": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.5.tgz", + "integrity": "sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w==", + "dev": true, + "requires": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + } + }, + "jest": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest/-/jest-29.6.1.tgz", + "integrity": "sha512-Nirw5B4nn69rVUZtemCQhwxOBhm0nsp3hmtF4rzCeWD7BkjAXRIji7xWQfnTNbz9g0aVsBX6aZK3n+23LM6uDw==", + "dev": true, + "requires": { + "@jest/core": "^29.6.1", + "@jest/types": "^29.6.1", + "import-local": "^3.0.2", + "jest-cli": "^29.6.1" + } + }, + "jest-changed-files": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.5.0.tgz", + "integrity": "sha512-IFG34IUMUaNBIxjQXF/iu7g6EcdMrGRRxaUSw92I/2g2YC6vCdTltl4nHvt7Ci5nSJwXIkCu8Ka1DKF+X7Z1Ag==", + "dev": true, + "requires": { + "execa": "^5.0.0", + "p-limit": "^3.1.0" + } + }, + "jest-circus": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.6.1.tgz", + "integrity": "sha512-tPbYLEiBU4MYAL2XoZme/bgfUeotpDBd81lgHLCbDZZFaGmECk0b+/xejPFtmiBP87GgP/y4jplcRpbH+fgCzQ==", + "dev": true, + "requires": { + "@jest/environment": "^29.6.1", + "@jest/expect": "^29.6.1", + "@jest/test-result": "^29.6.1", + "@jest/types": "^29.6.1", + "@types/node": "*", + "chalk": "^4.0.0", + "co": "^4.6.0", + "dedent": "^0.7.0", + "is-generator-fn": "^2.0.0", + "jest-each": "^29.6.1", + "jest-matcher-utils": "^29.6.1", + "jest-message-util": "^29.6.1", + "jest-runtime": "^29.6.1", + "jest-snapshot": "^29.6.1", + "jest-util": "^29.6.1", + "p-limit": "^3.1.0", + "pretty-format": "^29.6.1", + "pure-rand": "^6.0.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + } + }, + "jest-cli": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.6.1.tgz", + "integrity": "sha512-607dSgTA4ODIN6go9w6xY3EYkyPFGicx51a69H7yfvt7lN53xNswEVLovq+E77VsTRi5fWprLH0yl4DJgE8Ing==", + "dev": true, + "requires": { + "@jest/core": "^29.6.1", + "@jest/test-result": "^29.6.1", + "@jest/types": "^29.6.1", + "chalk": "^4.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "import-local": "^3.0.2", + "jest-config": "^29.6.1", + "jest-util": "^29.6.1", + "jest-validate": "^29.6.1", + "prompts": "^2.0.1", + "yargs": "^17.3.1" + } + }, + "jest-config": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.6.1.tgz", + "integrity": "sha512-XdjYV2fy2xYixUiV2Wc54t3Z4oxYPAELUzWnV6+mcbq0rh742X2p52pii5A3oeRzYjLnQxCsZmp0qpI6klE2cQ==", + "dev": true, + "requires": { + "@babel/core": "^7.11.6", + "@jest/test-sequencer": "^29.6.1", + "@jest/types": "^29.6.1", + "babel-jest": "^29.6.1", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "deepmerge": "^4.2.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-circus": "^29.6.1", + "jest-environment-node": "^29.6.1", + "jest-get-type": "^29.4.3", + "jest-regex-util": "^29.4.3", + "jest-resolve": "^29.6.1", + "jest-runner": "^29.6.1", + "jest-util": "^29.6.1", + "jest-validate": "^29.6.1", + "micromatch": "^4.0.4", + "parse-json": "^5.2.0", + "pretty-format": "^29.6.1", + "slash": "^3.0.0", + "strip-json-comments": "^3.1.1" + } + }, + "jest-diff": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.6.1.tgz", + "integrity": "sha512-FsNCvinvl8oVxpNLttNQX7FAq7vR+gMDGj90tiP7siWw1UdakWUGqrylpsYrpvj908IYckm5Y0Q7azNAozU1Kg==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "diff-sequences": "^29.4.3", + "jest-get-type": "^29.4.3", + "pretty-format": "^29.6.1" + } + }, + "jest-docblock": { + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.4.3.tgz", + "integrity": "sha512-fzdTftThczeSD9nZ3fzA/4KkHtnmllawWrXO69vtI+L9WjEIuXWs4AmyME7lN5hU7dB0sHhuPfcKofRsUb/2Fg==", + "dev": true, + "requires": { + "detect-newline": "^3.0.0" + } + }, + "jest-each": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.6.1.tgz", + "integrity": "sha512-n5eoj5eiTHpKQCAVcNTT7DRqeUmJ01hsAL0Q1SMiBHcBcvTKDELixQOGMCpqhbIuTcfC4kMfSnpmDqRgRJcLNQ==", + "dev": true, + "requires": { + "@jest/types": "^29.6.1", + "chalk": "^4.0.0", + "jest-get-type": "^29.4.3", + "jest-util": "^29.6.1", + "pretty-format": "^29.6.1" + } + }, + "jest-environment-node": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.6.1.tgz", + "integrity": "sha512-ZNIfAiE+foBog24W+2caIldl4Irh8Lx1PUhg/GZ0odM1d/h2qORAsejiFc7zb+SEmYPn1yDZzEDSU5PmDkmVLQ==", + "dev": true, + "requires": { + "@jest/environment": "^29.6.1", + "@jest/fake-timers": "^29.6.1", + "@jest/types": "^29.6.1", + "@types/node": "*", + "jest-mock": "^29.6.1", + "jest-util": "^29.6.1" + } + }, + "jest-get-type": { + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.4.3.tgz", + "integrity": "sha512-J5Xez4nRRMjk8emnTpWrlkyb9pfRQQanDrvWHhsR1+VUfbwxi30eVcZFlcdGInRibU4G5LwHXpI7IRHU0CY+gg==", + "dev": true + }, + "jest-haste-map": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.6.1.tgz", + "integrity": "sha512-0m7f9PZXxOCk1gRACiVgX85knUKPKLPg4oRCjLoqIm9brTHXaorMA0JpmtmVkQiT8nmXyIVoZd/nnH1cfC33ig==", + "dev": true, + "requires": { + "@jest/types": "^29.6.1", + "@types/graceful-fs": "^4.1.3", + "@types/node": "*", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "fsevents": "^2.3.2", + "graceful-fs": "^4.2.9", + "jest-regex-util": "^29.4.3", + "jest-util": "^29.6.1", + "jest-worker": "^29.6.1", + "micromatch": "^4.0.4", + "walker": "^1.0.8" + } + }, + "jest-leak-detector": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.6.1.tgz", + "integrity": "sha512-OrxMNyZirpOEwkF3UHnIkAiZbtkBWiye+hhBweCHkVbCgyEy71Mwbb5zgeTNYWJBi1qgDVfPC1IwO9dVEeTLwQ==", + "dev": true, + "requires": { + "jest-get-type": "^29.4.3", + "pretty-format": "^29.6.1" + } + }, + "jest-matcher-utils": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.6.1.tgz", + "integrity": "sha512-SLaztw9d2mfQQKHmJXKM0HCbl2PPVld/t9Xa6P9sgiExijviSp7TnZZpw2Fpt+OI3nwUO/slJbOfzfUMKKC5QA==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "jest-diff": "^29.6.1", + "jest-get-type": "^29.4.3", + "pretty-format": "^29.6.1" + } + }, + "jest-message-util": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.6.1.tgz", + "integrity": "sha512-KoAW2zAmNSd3Gk88uJ56qXUWbFk787QKmjjJVOjtGFmmGSZgDBrlIL4AfQw1xyMYPNVD7dNInfIbur9B2rd/wQ==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.12.13", + "@jest/types": "^29.6.1", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "micromatch": "^4.0.4", + "pretty-format": "^29.6.1", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + } + }, + "jest-mock": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.6.1.tgz", + "integrity": "sha512-brovyV9HBkjXAEdRooaTQK42n8usKoSRR3gihzUpYeV/vwqgSoNfrksO7UfSACnPmxasO/8TmHM3w9Hp3G1dgw==", + "dev": true, + "requires": { + "@jest/types": "^29.6.1", + "@types/node": "*", + "jest-util": "^29.6.1" + } + }, + "jest-pnp-resolver": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", + "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", + "dev": true, + "requires": {} + }, + "jest-regex-util": { + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.4.3.tgz", + "integrity": "sha512-O4FglZaMmWXbGHSQInfXewIsd1LMn9p3ZXB/6r4FOkyhX2/iP/soMG98jGvk/A3HAN78+5VWcBGO0BJAPRh4kg==", + "dev": true + }, + "jest-resolve": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.6.1.tgz", + "integrity": "sha512-AeRkyS8g37UyJiP9w3mmI/VXU/q8l/IH52vj/cDAyScDcemRbSBhfX/NMYIGilQgSVwsjxrCHf3XJu4f+lxCMg==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.6.1", + "jest-pnp-resolver": "^1.2.2", + "jest-util": "^29.6.1", + "jest-validate": "^29.6.1", + "resolve": "^1.20.0", + "resolve.exports": "^2.0.0", + "slash": "^3.0.0" + } + }, + "jest-resolve-dependencies": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.6.1.tgz", + "integrity": "sha512-BbFvxLXtcldaFOhNMXmHRWx1nXQO5LoXiKSGQcA1LxxirYceZT6ch8KTE1bK3X31TNG/JbkI7OkS/ABexVahiw==", + "dev": true, + "requires": { + "jest-regex-util": "^29.4.3", + "jest-snapshot": "^29.6.1" + } + }, + "jest-runner": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.6.1.tgz", + "integrity": "sha512-tw0wb2Q9yhjAQ2w8rHRDxteryyIck7gIzQE4Reu3JuOBpGp96xWgF0nY8MDdejzrLCZKDcp8JlZrBN/EtkQvPQ==", + "dev": true, + "requires": { + "@jest/console": "^29.6.1", + "@jest/environment": "^29.6.1", + "@jest/test-result": "^29.6.1", + "@jest/transform": "^29.6.1", + "@jest/types": "^29.6.1", + "@types/node": "*", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "graceful-fs": "^4.2.9", + "jest-docblock": "^29.4.3", + "jest-environment-node": "^29.6.1", + "jest-haste-map": "^29.6.1", + "jest-leak-detector": "^29.6.1", + "jest-message-util": "^29.6.1", + "jest-resolve": "^29.6.1", + "jest-runtime": "^29.6.1", + "jest-util": "^29.6.1", + "jest-watcher": "^29.6.1", + "jest-worker": "^29.6.1", + "p-limit": "^3.1.0", + "source-map-support": "0.5.13" + } + }, + "jest-runtime": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.6.1.tgz", + "integrity": "sha512-D6/AYOA+Lhs5e5il8+5pSLemjtJezUr+8zx+Sn8xlmOux3XOqx4d8l/2udBea8CRPqqrzhsKUsN/gBDE/IcaPQ==", + "dev": true, + "requires": { + "@jest/environment": "^29.6.1", + "@jest/fake-timers": "^29.6.1", + "@jest/globals": "^29.6.1", + "@jest/source-map": "^29.6.0", + "@jest/test-result": "^29.6.1", + "@jest/transform": "^29.6.1", + "@jest/types": "^29.6.1", + "@types/node": "*", + "chalk": "^4.0.0", + "cjs-module-lexer": "^1.0.0", + "collect-v8-coverage": "^1.0.0", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.6.1", + "jest-message-util": "^29.6.1", + "jest-mock": "^29.6.1", + "jest-regex-util": "^29.4.3", + "jest-resolve": "^29.6.1", + "jest-snapshot": "^29.6.1", + "jest-util": "^29.6.1", + "slash": "^3.0.0", + "strip-bom": "^4.0.0" + } + }, + "jest-snapshot": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.6.1.tgz", + "integrity": "sha512-G4UQE1QQ6OaCgfY+A0uR1W2AY0tGXUPQpoUClhWHq1Xdnx1H6JOrC2nH5lqnOEqaDgbHFgIwZ7bNq24HpB180A==", + "dev": true, + "requires": { + "@babel/core": "^7.11.6", + "@babel/generator": "^7.7.2", + "@babel/plugin-syntax-jsx": "^7.7.2", + "@babel/plugin-syntax-typescript": "^7.7.2", + "@babel/types": "^7.3.3", + "@jest/expect-utils": "^29.6.1", + "@jest/transform": "^29.6.1", + "@jest/types": "^29.6.1", + "@types/prettier": "^2.1.5", + "babel-preset-current-node-syntax": "^1.0.0", + "chalk": "^4.0.0", + "expect": "^29.6.1", + "graceful-fs": "^4.2.9", + "jest-diff": "^29.6.1", + "jest-get-type": "^29.4.3", + "jest-matcher-utils": "^29.6.1", + "jest-message-util": "^29.6.1", + "jest-util": "^29.6.1", + "natural-compare": "^1.4.0", + "pretty-format": "^29.6.1", + "semver": "^7.5.3" + }, + "dependencies": { + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + } + } + }, + "jest-util": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.6.1.tgz", + "integrity": "sha512-NRFCcjc+/uO3ijUVyNOQJluf8PtGCe/W6cix36+M3cTFgiYqFOOW5MgN4JOOcvbUhcKTYVd1CvHz/LWi8d16Mg==", + "dev": true, + "requires": { + "@jest/types": "^29.6.1", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" + } + }, + "jest-validate": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.6.1.tgz", + "integrity": "sha512-r3Ds69/0KCN4vx4sYAbGL1EVpZ7MSS0vLmd3gV78O+NAx3PDQQukRU5hNHPXlyqCgFY8XUk7EuTMLugh0KzahA==", + "dev": true, + "requires": { + "@jest/types": "^29.6.1", + "camelcase": "^6.2.0", + "chalk": "^4.0.0", + "jest-get-type": "^29.4.3", + "leven": "^3.1.0", + "pretty-format": "^29.6.1" + }, + "dependencies": { + "camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true + } + } + }, + "jest-watcher": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.6.1.tgz", + "integrity": "sha512-d4wpjWTS7HEZPaaj8m36QiaP856JthRZkrgcIY/7ISoUWPIillrXM23WPboZVLbiwZBt4/qn2Jke84Sla6JhFA==", + "dev": true, + "requires": { + "@jest/test-result": "^29.6.1", + "@jest/types": "^29.6.1", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "jest-util": "^29.6.1", + "string-length": "^4.0.1" + } + }, + "jest-worker": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.6.1.tgz", + "integrity": "sha512-U+Wrbca7S8ZAxAe9L6nb6g8kPdia5hj32Puu5iOqBCMTMWFHXuK6dOV2IFrpedbTV8fjMFLdWNttQTBL6u2MRA==", + "dev": true, + "requires": { + "@types/node": "*", + "jest-util": "^29.6.1", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "dependencies": { + "supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true + }, + "json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true + }, + "kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "dev": true + }, + "leven": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "dev": true + }, + "lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "requires": { + "yallist": "^3.0.2" + } + }, + "make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "requires": { + "semver": "^6.0.0" + } + }, + "makeerror": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", + "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", + "dev": true, + "requires": { + "tmpl": "1.0.5" + } + }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "requires": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + } + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, + "node-int64": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", + "dev": true + }, + "node-releases": { + "version": "2.0.13", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", + "integrity": "sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==", + "dev": true + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, + "npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "requires": { + "path-key": "^3.0.0" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + }, + "dependencies": { + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + } + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + } + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true + }, + "pirates": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", + "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", + "dev": true + }, + "pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "requires": { + "find-up": "^4.0.0" + } + }, + "pretty-format": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.6.1.tgz", + "integrity": "sha512-7jRj+yXO0W7e4/tSJKoR7HRIHLPPjtNaUGG2xxKQnGvPNRkgWcQ0AZX6P4KBRJN4FcTBWb3sa7DVUJmocYuoog==", + "dev": true, + "requires": { + "@jest/schemas": "^29.6.0", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true + } + } + }, + "prompts": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", + "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", + "dev": true, + "requires": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" + } + }, + "pure-rand": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.0.2.tgz", + "integrity": "sha512-6Yg0ekpKICSjPswYOuC5sku/TSWaRYlA0qsXqJgM/d/4pLPHPuTxK7Nbf7jFKzAeedUhR8C7K9Uv63FBsSo8xQ==", + "dev": true + }, + "react-is": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", + "dev": true + }, + "rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", + "dev": true, + "requires": { + "resolve": "^1.1.6" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true + }, + "resolve": { + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", + "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", + "dev": true, + "requires": { + "is-core-module": "^2.11.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "dev": true, + "requires": { + "resolve-from": "^5.0.0" + } + }, + "resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true + }, + "resolve.exports": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", + "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==", + "dev": true + }, + "semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "shelljs": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", + "dev": true, + "requires": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + } + }, + "shx": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/shx/-/shx-0.3.4.tgz", + "integrity": "sha512-N6A9MLVqjxZYcVn8hLmtneQWIJtp8IKzMP4eMnx+nqkvXoqinUPCbUFLp2UcWTEIUONhlk0ewxr/jaVGlc+J+g==", + "dev": true, + "requires": { + "minimist": "^1.2.3", + "shelljs": "^0.8.5" + } + }, + "sigmajs-crypto-facade": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/sigmajs-crypto-facade/-/sigmajs-crypto-facade-0.0.6.tgz", + "integrity": "sha512-Nbz+CZ0rgMvDN76C3bQjrFHO30qSHE9Fti+Co4WvNzL9UTaxSOlfSFJy89u0QX+IkVNvXd35RqiyiekLpTUSsA==", + "requires": { + "@noble/hashes": "^1.1.4" + } + }, + "signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "sisteransi": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", + "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", + "dev": true + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "source-map-support": { + "version": "0.5.13", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", + "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true + }, + "stack-utils": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", + "dev": true, + "requires": { + "escape-string-regexp": "^2.0.0" + } + }, + "string-length": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", + "integrity": "sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==", + "dev": true, + "requires": { + "char-regex": "^1.0.2", + "strip-ansi": "^6.0.0" + } + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "strip-bom": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", + "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", + "dev": true + }, + "strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true + }, + "test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "requires": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + } + }, + "tmpl": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", + "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", + "dev": true + }, + "to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", + "dev": true + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true + }, + "type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true + }, + "typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "dev": true + }, + "update-browserslist-db": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz", + "integrity": "sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==", + "dev": true, + "requires": { + "escalade": "^3.1.1", + "picocolors": "^1.0.0" + } + }, + "v8-to-istanbul": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.0.tgz", + "integrity": "sha512-6z3GW9x8G1gd+JIIgQQQxXuiJtCXeAjp6RaPEPLv62mH3iPHPxV6W3robxtCzNErRo6ZwTmzWhsbNvjyEBKzKA==", + "dev": true, + "requires": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^1.6.0" + }, + "dependencies": { + "convert-source-map": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", + "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", + "dev": true + } + } + }, + "walker": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", + "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", + "dev": true, + "requires": { + "makeerror": "1.0.12" + } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "write-file-atomic": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", + "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.7" + } + }, + "y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + }, + "yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "requires": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + } + }, + "yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true + }, + "yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true + } + } +} From c8079b897caa9efefbe6cca4434752842eced674 Mon Sep 17 00:00:00 2001 From: arobsn Date: Wed, 12 Jul 2023 15:22:27 -0300 Subject: [PATCH 47/58] add TS typedefs --- sigma-js/jest.config.js | 4 +- sigma-js/package.json | 2 + sigma-js/sigmastate-js.d.ts | 73 +++++++++++++++++++++++++ sigma-js/tests/js/ErgoTree.spec.js | 2 +- sigma-js/tests/js/SigmaCompiler.spec.js | 2 +- sigma-js/tests/js/Type.spec.js | 2 +- sigma-js/tests/js/Value.spec.js | 2 +- 7 files changed, 82 insertions(+), 5 deletions(-) create mode 100644 sigma-js/sigmastate-js.d.ts diff --git a/sigma-js/jest.config.js b/sigma-js/jest.config.js index 34dbc9a68c..3c69644eec 100644 --- a/sigma-js/jest.config.js +++ b/sigma-js/jest.config.js @@ -1,8 +1,10 @@ /** @type {import("jest").Config} */ const config = { + transform: {}, // reduce non-cached test time by about 20x by disabling babel code transformation moduleDirectories: ["/node_modules"], moduleNameMapper: { - "sigmastate-js": "/../sc/js/target/scala-2.13/sc-fastopt/main.js", + "sigmastate-js/main": + "/../sc/js/target/scala-2.13/sc-fastopt/main.js", }, }; diff --git a/sigma-js/package.json b/sigma-js/package.json index 6c420307be..b7b9aaa182 100644 --- a/sigma-js/package.json +++ b/sigma-js/package.json @@ -5,8 +5,10 @@ "main": "dist/main.js", "files": [ "dist/", + "sigmastate-js.d.ts", "README.md" ], + "types": "./sigmastate-js.d.ts", "exports": { "./internal-*": null, "./*": "./dist/*.js" diff --git a/sigma-js/sigmastate-js.d.ts b/sigma-js/sigmastate-js.d.ts new file mode 100644 index 0000000000..9351297677 --- /dev/null +++ b/sigma-js/sigmastate-js.d.ts @@ -0,0 +1,73 @@ +declare module "sigmastate-js/main" { + type SigmaCompilerNamedConstantsMap = { [key: string]: Value }; + type HexString = string; + + class ErgoTree { + toHex(): HexString; + bytes(): { u: Uint8Array }; + header(): number; + version(): number; + isConstantSegregation(): boolean; + hasSize(): boolean; + constants(): Value[]; + toString(): string; + } + + class ErgoTreeObj { + static fromHex(value: HexString): ErgoTree; + } + + class Type { + name: string; + toString(): string; + } + + class TypeObj { + static Byte: Type; + static Short: Type; + static Int: Type; + static Long: Type; + static BigInt: Type; + static GroupElement: Type; + static SigmaProp: Type; + static Box: Type; + static AvlTree: Type; + static Context: Type; + static Header: Type; + static PreHeader: Type; + static SigmaDslBuilder: Type; + static pairType(left: Type, right: Type): Type; + static collType(elemType: Type): Type; + } + + class Value { + data: T; + tpe: Type; + toHex(): HexString; + } + + class ValueObj { + static ofByte(value: number): Value; + static ofShort(value: number): Value; + static ofInt(value: number): Value; + static ofLong(value: bigint): Value; + static ofBigInt(value: bigint): Value; + static pairOf(left: Value, right: Value): Value<[R, L]>; + static collOf(items: T[], type: Type): Value; + static fromHex(hex: HexString): Value; + } + + class SigmaCompiler { + compile( + namedConstants: SigmaCompilerNamedConstantsMap, + segregateConstants: boolean, + additionalHeaderFlags: number, + ergoScript: string + ): ErgoTree; + } + + class SigmaCompilerObj { + static forMainnet(): SigmaCompiler; + static forTestnet(): SigmaCompiler; + } +} diff --git a/sigma-js/tests/js/ErgoTree.spec.js b/sigma-js/tests/js/ErgoTree.spec.js index a0647474ba..f951b2ea99 100644 --- a/sigma-js/tests/js/ErgoTree.spec.js +++ b/sigma-js/tests/js/ErgoTree.spec.js @@ -1,4 +1,4 @@ -const { ErgoTree, ErgoTreeObj } = require("sigmastate-js"); +const { ErgoTree, ErgoTreeObj } = require("sigmastate-js/main"); describe("Smoke tests for API exporting", () => { it("Should export ErgoTree object", () => { diff --git a/sigma-js/tests/js/SigmaCompiler.spec.js b/sigma-js/tests/js/SigmaCompiler.spec.js index f265faae39..6e531d63aa 100644 --- a/sigma-js/tests/js/SigmaCompiler.spec.js +++ b/sigma-js/tests/js/SigmaCompiler.spec.js @@ -1,4 +1,4 @@ -const { ValueObj, SigmaCompilerObj } = require("sigmastate-js"); +const { ValueObj, SigmaCompilerObj } = require("sigmastate-js/main"); describe("Smoke tests for API exporting", () => { let compiler = SigmaCompilerObj.forMainnet(); diff --git a/sigma-js/tests/js/Type.spec.js b/sigma-js/tests/js/Type.spec.js index 089151331d..fe1b0c0383 100644 --- a/sigma-js/tests/js/Type.spec.js +++ b/sigma-js/tests/js/Type.spec.js @@ -1,4 +1,4 @@ -const { TypeObj } = require("sigmastate-js"); +const { TypeObj } = require("sigmastate-js/main"); describe("Smoke tests for Types", () => { diff --git a/sigma-js/tests/js/Value.spec.js b/sigma-js/tests/js/Value.spec.js index 7341bee567..bac3251d4c 100644 --- a/sigma-js/tests/js/Value.spec.js +++ b/sigma-js/tests/js/Value.spec.js @@ -1,4 +1,4 @@ -const { TypeObj, ValueObj } = require("sigmastate-js"); +const { TypeObj, ValueObj } = require("sigmastate-js/main"); function testRange(factory, min, max) { expect(factory(max).data).toEqual(max); From ac1f3d3697b4b19f45ef6f43c60a06a97164873d Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Wed, 12 Jul 2023 22:56:13 +0200 Subject: [PATCH 48/58] sigma-js bump verson v0.2.1 --- sigma-js/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sigma-js/package.json b/sigma-js/package.json index b7b9aaa182..76e784a387 100644 --- a/sigma-js/package.json +++ b/sigma-js/package.json @@ -1,6 +1,6 @@ { "name": "sigmastate-js", - "version": "0.2.0", + "version": "0.2.1", "description": "Sigma.js library", "main": "dist/main.js", "files": [ From e833bf2da06af112fef91dbae89ce037cc986f74 Mon Sep 17 00:00:00 2001 From: "Alison Robson (anon_br)" Date: Fri, 14 Jul 2023 10:04:40 -0300 Subject: [PATCH 49/58] Add JS CI (#892) * CI: run js tests and publish snapshots * CI: add npm publishing tag * CI: fix ci.yml file * CI: adjust npm setup step * CI: temporarily skip non js related steps * CI: set node registry URL * CI: use nodejs v20 * CI: add stable release * CI: remove npm cache * CI: fix npm caching issues * CI: add cache dependency path * remove accidentally committed yarn.lock file --- .github/workflows/ci.yml | 44 +++++++++++++++++++------- .github/workflows/release.yml | 22 +++++++++++++ sigma-js/package.json | 3 +- sigma-js/scripts/setSnapshotVersion.js | 9 ++++++ 4 files changed, 65 insertions(+), 13 deletions(-) create mode 100644 sigma-js/scripts/setSnapshotVersion.js diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f2b6b22f3d..0b35199245 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,10 +55,10 @@ jobs: # env: # COVERALLS_REPO_TOKEN: $${{ secrets.COVERALLS_REPO_TOKEN }} -# - name: Upload coverage report to Codecov -# uses: codecov/codecov-action@v1 -# with: -# fail_ci_if_error: false + # - name: Upload coverage report to Codecov + # uses: codecov/codecov-action@v1 + # with: + # fail_ci_if_error: false - name: Publish a snapshot ${{ github.ref }} if: env.HAS_SECRETS == 'true' @@ -68,7 +68,7 @@ jobs: SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} buildJs: - name: JS - Test and publish a snapshot + name: JS - Test and publish snapshots env: HAS_SECRETS: ${{ secrets.SONATYPE_PASSWORD != '' }} strategy: @@ -76,7 +76,7 @@ jobs: os: [ubuntu-latest] scala: [2.13.11] java: [adopt@1.8] - node-version: [16.x] + node-version: [20] runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) @@ -85,12 +85,15 @@ jobs: fetch-depth: 0 - name: Setup NPM - uses: pnpm/action-setup@v2 + uses: actions/setup-node@v3 with: - version: 7.21.0 node-version: ${{ matrix.node-version }} - cache: "pnpm" - - run: pnpm install --prefix sigma-js + registry-url: https://registry.npmjs.org/ + cache: npm + cache-dependency-path: ./sigma-js/package-lock.json + + - name: Install NPM dependencies + run: npm ci --prefix sigma-js - name: Setup Java and Scala uses: olafurpg/setup-scala@v10 @@ -110,11 +113,28 @@ jobs: key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} - name: Runs tests and collect coverage - run: sbt -jvm-opts ci/ci.jvmopts ++${{ matrix.scala }} commonJS/test corelibJS/test interpreterJS/test graphirJS/test sdkJS/test + run: sbt -jvm-opts ci/ci.jvmopts ++${{ matrix.scala }} commonJS/test corelibJS/test interpreterJS/test graphirJS/test sdkJS/test - - name: Publish a snapshot ${{ github.ref }} + - name: Publish a JVM snapshot ${{ github.ref }} if: env.HAS_SECRETS == 'true' run: sbt ++${{ matrix.scala }} sdkJS/publish env: SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + + - name: JS Build + run: sbt -jvm-opts ci/ci.jvmopts ++${{ matrix.scala }} scJS/fastOptJS + + - name: Runs JS tests + run: npm run test + working-directory: ./sigma-js + + - name: Setup JS snapshot + run: npm run ci:snapshot + working-directory: ./sigma-js + + - name: Publish JS snapshot ${{ github.ref }} + run: npm publish --tag snapshot + working-directory: ./sigma-js + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 584e7bfc6c..b6f999d4a6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,6 +31,19 @@ jobs: ~/Library/Caches/Coursier/v1 key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} + - name: Setup NPM + uses: actions/setup-node@v3 + with: + node-version: 20 + registry-url: https://registry.npmjs.org/ + cache: npm + cache-dependency-path: ./sigma-js/package-lock.json + + - name: Install NPM dependencies + run: npm ci --prefix sigma-js + # Ensure latest npm version to be installed for npm provenance support + - run: npm install -g npm + - name: Import GPG key run: ci/import_gpg.sh env: @@ -42,3 +55,12 @@ jobs: PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + + - name: JS Build + run: sbt -jvm-opts ci/ci.jvmopts scJS/fastOptJS + + - name: Publish JS snapshot ${{ github.ref }} + run: npm publish --provenance + working-directory: ./sigma-js + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/sigma-js/package.json b/sigma-js/package.json index 76e784a387..1e65230766 100644 --- a/sigma-js/package.json +++ b/sigma-js/package.json @@ -30,7 +30,8 @@ "test": "jest", "clean": "shx rm -rf ./dist/*", "copy-output": "shx mkdir -p ./dist/ && cp -r ../sc/js/target/scala-2.13/sc-fastopt/* ./dist/", - "prepublishOnly": "npm run clean && npm run copy-output" + "prepublishOnly": "npm run clean && npm run copy-output", + "ci:snapshot": "node ./scripts/setSnapshotVersion" }, "dependencies": { "@noble/hashes": "1.1.4", diff --git a/sigma-js/scripts/setSnapshotVersion.js b/sigma-js/scripts/setSnapshotVersion.js new file mode 100644 index 0000000000..2b4496cfdb --- /dev/null +++ b/sigma-js/scripts/setSnapshotVersion.js @@ -0,0 +1,9 @@ +const fs = require("fs"); +const pkg = require("../package.json"); +const gitHash = require("child_process") + .execSync("git rev-parse --short HEAD") + .toString() + .trim(); + +pkg.version = `${pkg.version}-snapshot.${gitHash}`; +fs.writeFileSync("./package.json", JSON.stringify(pkg, null, 2)); From db8d9dbe77ec4e3bb9545c3d2a6863b385b384e5 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Tue, 18 Jul 2023 17:36:08 +0200 Subject: [PATCH 50/58] v5.0.10-RC: cleanup + ScalaDocs --- .github/workflows/ci.yml | 10 -- .../scala/scalan/reflection/Platform.scala | 4 +- .../scala/scalan/reflection/JavaImpl.scala | 1 - .../main/scala/sigmastate/Environment.scala | 2 - .../scala/sigmastate/RuntimePlatform.scala | 2 + .../scala/scalan/util/BenchmarkUtil.scala | 3 + .../main/scala/special/collection/Colls.scala | 10 +- .../scala/special/collection/package.scala | 6 +- .../js/src/test/scala/scalan/Platform.scala | 2 +- .../special/collection/impl/CollsImpl.scala | 7 +- .../src/test/scala/scalan/TestContexts.scala | 4 +- .../src/main/scala/sigmastate/Platform.scala | 1 + .../scala/sigmastate/eval/Extensions.scala | 3 +- .../scala/sigmastate/lang/LangTests.scala | 1 + .../sigmastate/lang/js/SigmaCompiler.scala | 16 +++ .../scala/sigmastate/TypesSpecification.scala | 111 +++++++++--------- .../utxo/BasicOpsSpecification.scala | 1 + .../scala/org/ergoplatform/sdk/js/Isos.scala | 1 - .../org/ergoplatform/sdk/js/SigmaProp.scala | 2 +- 19 files changed, 106 insertions(+), 81 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0b35199245..5398146f45 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,16 +50,6 @@ jobs: - name: Runs tests run: sbt -jvm-opts ci/ci.jvmopts ++${{ matrix.scala }} test - # - name: Upload coverage report - # run: sbt ++${{ matrix.scala }} coverageReport coverageAggregate coveralls - # env: - # COVERALLS_REPO_TOKEN: $${{ secrets.COVERALLS_REPO_TOKEN }} - - # - name: Upload coverage report to Codecov - # uses: codecov/codecov-action@v1 - # with: - # fail_ci_if_error: false - - name: Publish a snapshot ${{ github.ref }} if: env.HAS_SECRETS == 'true' run: sbt ++${{ matrix.scala }} publish diff --git a/common/js/src/main/scala/scalan/reflection/Platform.scala b/common/js/src/main/scala/scalan/reflection/Platform.scala index 9b8f1694a2..7b4c2d74e6 100644 --- a/common/js/src/main/scala/scalan/reflection/Platform.scala +++ b/common/js/src/main/scala/scalan/reflection/Platform.scala @@ -50,7 +50,9 @@ object Platform { } } - /** This method works for Scala 2.13+ */ + /** This method works for Scala 2.13+. Sigma.js is compiled only with Scala 2.13+, hence + * using getSimpleName is ok. + * @see https://github.com/scala/bug/issues/5425 */ def safeSimpleName(cl: Class[_]): String = { cl.getSimpleName } diff --git a/common/jvm/src/main/scala/scalan/reflection/JavaImpl.scala b/common/jvm/src/main/scala/scalan/reflection/JavaImpl.scala index f5de4ccadd..fba9fcd29c 100644 --- a/common/jvm/src/main/scala/scalan/reflection/JavaImpl.scala +++ b/common/jvm/src/main/scala/scalan/reflection/JavaImpl.scala @@ -130,7 +130,6 @@ object JRConstructor { /** * Implements [[RMethod]] using Java reflection. * - * @param declaringClass The JRClass that declares this method. * @param value The [[java.lang.reflect.Method]] instance that this JRMethod represents. */ class JRMethod private (val value: Method) extends RMethod { diff --git a/common/shared/src/main/scala/sigmastate/Environment.scala b/common/shared/src/main/scala/sigmastate/Environment.scala index 17415a4a65..f15752aa9c 100644 --- a/common/shared/src/main/scala/sigmastate/Environment.scala +++ b/common/shared/src/main/scala/sigmastate/Environment.scala @@ -1,7 +1,5 @@ package sigmastate -import scalan.reflection.Platform - /** Describes the current execution environment. */ sealed abstract class Environment { /** Runtime platform for the current environment. */ diff --git a/common/shared/src/main/scala/sigmastate/RuntimePlatform.scala b/common/shared/src/main/scala/sigmastate/RuntimePlatform.scala index d45b727465..b6d0bc30fb 100644 --- a/common/shared/src/main/scala/sigmastate/RuntimePlatform.scala +++ b/common/shared/src/main/scala/sigmastate/RuntimePlatform.scala @@ -7,10 +7,12 @@ sealed trait RuntimePlatform { } object RuntimePlatform { + /** Represent JVM platform. */ case object JVM extends RuntimePlatform { val code = 1 } + /** Represent JS platform. */ case object JS extends RuntimePlatform { val code = 2 } diff --git a/common/shared/src/test/scala/scalan/util/BenchmarkUtil.scala b/common/shared/src/test/scala/scalan/util/BenchmarkUtil.scala index 8a55512ae4..a06a7d859d 100644 --- a/common/shared/src/test/scala/scalan/util/BenchmarkUtil.scala +++ b/common/shared/src/test/scala/scalan/util/BenchmarkUtil.scala @@ -41,6 +41,9 @@ object BenchmarkUtil { (res, end - start) } + /** Runs `n` instances of the given block in parallel, await completion and measure the + * total time. The time is printed to the console. + */ def runTasks(nTasks: Int)(block: Int => Unit) = { val (_, total) = measureTime { val tasks = (1 to nTasks).map(iTask => Future(block(iTask))) diff --git a/core-lib/shared/src/main/scala/special/collection/Colls.scala b/core-lib/shared/src/main/scala/special/collection/Colls.scala index 77620472ee..027297de18 100644 --- a/core-lib/shared/src/main/scala/special/collection/Colls.scala +++ b/core-lib/shared/src/main/scala/special/collection/Colls.scala @@ -2,7 +2,10 @@ package special.collection import scalan._ -/** Indexed (zero-based) collection of elements of type `A` +/** Indexed (zero-based) collection of elements of type `A`. + * NOTE: declaring it `abstract class` makes some performance benefits, but doesn't work + * well with specialization. + * * @define Coll `Coll` * @define coll collection * @define colls collections @@ -290,6 +293,11 @@ trait Coll[@specialized A] { } } +/** Base trait for specialized (Structure-Of-Arrays) representation of collection of pairs + * (i.e. `Coll[(A, B)]`). + * Some instances of `Coll[(A, B)]` may be instances of this trait, but it is NOT guaranteed, + * since some of them may be instances of `CollOverArray[(A, B)]`. + */ trait PairColl[@specialized L, @specialized R] extends Coll[(L,R)] { def ls: Coll[L] def rs: Coll[R] diff --git a/core-lib/shared/src/main/scala/special/collection/package.scala b/core-lib/shared/src/main/scala/special/collection/package.scala index 71658396c2..826c1bd3b5 100644 --- a/core-lib/shared/src/main/scala/special/collection/package.scala +++ b/core-lib/shared/src/main/scala/special/collection/package.scala @@ -6,8 +6,9 @@ import scalan.RType import scala.reflect.{classTag, ClassTag} package collection { + /** Type descriptor for `Coll[A]` type. */ case class CollType[A](tItem: RType[A]) extends RType[Coll[A]] { - val classTag: ClassTag[Coll[A]] = ClassTag[Coll[A]](classOf[Coll[A]]) + override val classTag: ClassTag[Coll[A]] = ClassTag[Coll[A]](classOf[Coll[A]]) override def name: String = s"Coll[${tItem.name}]" } } @@ -16,7 +17,8 @@ package object collection { /** Forces reflection data initialization */ val reflection = CoreLibReflection + /** Implicit resolution of `Coll[A]` type descriptor, given a descriptor of `A`. */ implicit def collRType[A](implicit tA: RType[A]): RType[Coll[A]] = CollType[A](tA) - implicit def extendCollType[A](ct: RType[Coll[A]]): CollType[A] = ct.asInstanceOf[CollType[A]] + implicit val collBuilderRType: RType[CollBuilder] = RType.fromClassTag(classTag[CollBuilder]) } diff --git a/graph-ir/js/src/test/scala/scalan/Platform.scala b/graph-ir/js/src/test/scala/scalan/Platform.scala index 5ec15fa4ee..5f938111d2 100644 --- a/graph-ir/js/src/test/scala/scalan/Platform.scala +++ b/graph-ir/js/src/test/scala/scalan/Platform.scala @@ -3,7 +3,7 @@ package scalan import scala.annotation.unused object Platform { - /** In JS tests do nothing. (The corresponding JVM method outputs graphs into files. */ + /** In JS tests do nothing. The corresponding JVM method outputs graphs into files. */ def stage[Ctx <: Scalan](scalan: Ctx)( @unused prefix: String, @unused testName: String, diff --git a/graph-ir/shared/src/main/scala/special/collection/impl/CollsImpl.scala b/graph-ir/shared/src/main/scala/special/collection/impl/CollsImpl.scala index aee4ea3359..0437f6c97f 100644 --- a/graph-ir/shared/src/main/scala/special/collection/impl/CollsImpl.scala +++ b/graph-ir/shared/src/main/scala/special/collection/impl/CollsImpl.scala @@ -5,8 +5,7 @@ import scalan._ import scala.collection.compat.immutable.ArraySeq package impl { - import scalan.reflection.CommonReflection.registerClassEntry - import scalan.reflection.{SRConstructor, RClass, RMethod, SRMethod} + import scalan.reflection.{RClass, RMethod} // Abs ----------------------------------- trait CollsDefs extends scalan.Scalan with Colls { @@ -166,7 +165,7 @@ class CollCls extends EntityObject("Coll") { extends Liftable[SColl[SA], Coll[A]] { lazy val eW: Elem[Coll[A]] = collElement(lA.eW) lazy val sourceType: RType[SColl[SA]] = { - implicit val tagSA = lA.sourceType.asInstanceOf[RType[SA]] + implicit val tagSA: RType[SA] = lA.sourceType RType[SColl[SA]] } def lift(x: SColl[SA]): Ref[Coll[A]] = CollConst(x, lA) @@ -180,7 +179,7 @@ class CollCls extends EntityObject("Coll") { case class CollAdapter[A](source: Ref[Coll[A]]) extends Node with Coll[A] with Def[Coll[A]] { - implicit lazy val eA = source.elem.typeArgs("A")._1.asInstanceOf[Elem[A]] + implicit lazy val eA: Elem[A] = source.elem.typeArgs("A")._1.asInstanceOf[Elem[A]] val resultType: Elem[Coll[A]] = element[Coll[A]] override def transform(t: Transformer) = CollAdapter[A](t(source)) diff --git a/graph-ir/shared/src/test/scala/scalan/TestContexts.scala b/graph-ir/shared/src/test/scala/scalan/TestContexts.scala index 5f39bfe654..2b01269672 100644 --- a/graph-ir/shared/src/test/scala/scalan/TestContexts.scala +++ b/graph-ir/shared/src/test/scala/scalan/TestContexts.scala @@ -11,7 +11,6 @@ trait TestContexts extends TestUtils { def shouldUnpack(e: Elem[_]): Boolean def testName: String def emitF(name: String, sfs: (() => Sym)*): Unit - // def emit(name: String, s1: => Sym): Unit = emitF(name, () => s1) def emit(name: String, ss: Sym*): Unit = { emitF(name, ss.map((s: Ref[_]) => () => s): _*) } @@ -28,7 +27,8 @@ trait TestContexts extends TestUtils { override def shouldUnpack(e: Elem[_]) = true // workaround for non-existence of by-name repeated parameters - def emitF(name: String, sfs: (() => Sym)*): Unit = Platform.stage(this)(prefix, testName, name, sfs) + def emitF(name: String, sfs: (() => Sym)*): Unit = + Platform.stage(this)(prefix, testName, name, sfs) } diff --git a/interpreter/jvm/src/main/scala/sigmastate/Platform.scala b/interpreter/jvm/src/main/scala/sigmastate/Platform.scala index d14c66da5c..abfc3ad261 100644 --- a/interpreter/jvm/src/main/scala/sigmastate/Platform.scala +++ b/interpreter/jvm/src/main/scala/sigmastate/Platform.scala @@ -10,6 +10,7 @@ import special.sigma.{AnyValue, AvlTree, GroupElement, SigmaProp} import java.math.BigInteger +/** JVM specific implementations */ object Platform { /** Creates a new Constant instance with an appropriate type derived from the given data `obj`. * Uses scalan.Nullable instead of scala.Option to avoid allocation on consensus hot path. diff --git a/interpreter/shared/src/main/scala/sigmastate/eval/Extensions.scala b/interpreter/shared/src/main/scala/sigmastate/eval/Extensions.scala index 2b5b4bcd91..d765e01c41 100644 --- a/interpreter/shared/src/main/scala/sigmastate/eval/Extensions.scala +++ b/interpreter/shared/src/main/scala/sigmastate/eval/Extensions.scala @@ -63,13 +63,14 @@ object Extensions { * precisely describes the type of elements in `call`. (Which is the case for all * collections created by ErgoTree interpreter). * - * However it is not the case, then JVM and JS will have different semantics for Byte and Short. + * However, if it is not the case, then JVM and JS will have different semantics for Byte and Short. * * The JVM version preserves v5.0 consensus protocol semantics. * The JS version is a reasonable approximation of the JVM version. */ def toArrayOfConstants: Array[Constant[SType]] = { val constants = coll.toArray.map { v => + // see ScalaDoc for ensureTypeCarringValue val valToLift = Helpers.ensureTypeCarringValue(v, coll.tItem.asInstanceOf[RType[Any]]) // call platform-specific method to transform the value to a Constant Platform.liftToConstant(valToLift, TransformingSigmaBuilder) match { diff --git a/parsers/shared/src/test/scala/sigmastate/lang/LangTests.scala b/parsers/shared/src/test/scala/sigmastate/lang/LangTests.scala index 7277526f01..80ef976e1e 100644 --- a/parsers/shared/src/test/scala/sigmastate/lang/LangTests.scala +++ b/parsers/shared/src/test/scala/sigmastate/lang/LangTests.scala @@ -50,6 +50,7 @@ trait LangTests extends Matchers with NegativeTesting { protected val p2: SigmaBoolean = ProveDlog(ecp2) protected val dht1: SigmaBoolean = ProveDHTuple(ecp1, ecp2, ecp3, ecp4) + // to support both JVM and JS we need to wrap numeric values into CAnyValue val env = Map( "x" -> CAnyValue(10), "y" -> CAnyValue(11), "c1" -> true, "c2" -> false, "height1" -> 100L, "height2" -> 200L, diff --git a/sc/js/src/main/scala/sigmastate/lang/js/SigmaCompiler.scala b/sc/js/src/main/scala/sigmastate/lang/js/SigmaCompiler.scala index c915b3ee7d..d428a75294 100644 --- a/sc/js/src/main/scala/sigmastate/lang/js/SigmaCompiler.scala +++ b/sc/js/src/main/scala/sigmastate/lang/js/SigmaCompiler.scala @@ -12,9 +12,18 @@ import sigmastate.eval.CompiletimeIRContext import sigmastate.lang.Terms.ValueOps +/** Wrapper exported to JS. */ @JSExportTopLevel("SigmaCompiler") class SigmaCompiler(_compiler: sigmastate.lang.SigmaCompiler) extends js.Object { + /** Compiles ErgoScript code to ErgoTree. + * + * @param namedConstants named constants to be used in the script + * @param segregateConstants if true, then constants will be segregated from the tree + * @param additionalHeaderFlags additional header flags to be set in the tree + * @param ergoScript ErgoScript code to be compiled + * @return ErgoTree instance + */ def compile( namedConstants: StringDictionary[Value], segregateConstants: Boolean, @@ -37,10 +46,17 @@ class SigmaCompiler(_compiler: sigmastate.lang.SigmaCompiler) extends js.Object @JSExportTopLevel("SigmaCompilerObj") object SigmaCompiler extends js.Object { + /** Creates a new instance of SigmaCompiler for the mainnet. */ def forMainnet(): SigmaCompiler = create(ErgoAddressEncoder.MainnetNetworkPrefix) + /** Creates a new instance of SigmaCompiler for the testnet. */ def forTestnet(): SigmaCompiler = create(ErgoAddressEncoder.TestnetNetworkPrefix) + /** Creates a new instance of SigmaCompiler for the given network prefix. + * + * @param networkPrefix network prefix to be used in the compiler + * @return SigmaCompiler instance + */ private def create(networkPrefix: Byte): SigmaCompiler = { val compiler = new sigmastate.lang.SigmaCompiler(networkPrefix) new SigmaCompiler(compiler) diff --git a/sc/shared/src/test/scala/sigmastate/TypesSpecification.scala b/sc/shared/src/test/scala/sigmastate/TypesSpecification.scala index 9baabf79c9..6ae4bd2a21 100644 --- a/sc/shared/src/test/scala/sigmastate/TypesSpecification.scala +++ b/sc/shared/src/test/scala/sigmastate/TypesSpecification.scala @@ -20,105 +20,108 @@ class TypesSpecification extends SigmaTestingData { import TestData._ property("SType.isValueOfType test vectors") { - def assertTrue(x: Any, t: SType) = { + def assertValidType(x: Any, t: SType) = { withClue(s"x = $x, t = $t: ") { isValueOfType(x, t) shouldBe true } } - def assertFalse(x: Any, t: SType) = { + def assertInvalidType(x: Any, t: SType) = { withClue(s"x = $x, t = $t: ") { isValueOfType(x, t) shouldBe false } } - assertTrue(true, SBoolean) - assertTrue(false, SBoolean) - assertFalse(true, SByte) + assertValidType(true, SBoolean) + assertValidType(false, SBoolean) + assertInvalidType(true, SByte) - assertTrue(0.toByte, SByte) + assertValidType(0.toByte, SByte) if (Environment.current.isJVM) { - assertFalse(0.toByte, SShort) - } else { // JS - assertTrue(0.toByte, SShort) + assertInvalidType(0.toByte, SShort) + } else { + // Note difference in JS behavior + assertValidType(0.toByte, SShort) } - assertTrue(0.toShort, SShort) + assertValidType(0.toShort, SShort) if (Environment.current.isJVM) { - assertFalse(0.toShort, SInt) - } else { // JS - assertTrue(0.toShort, SInt) + assertInvalidType(0.toShort, SInt) + } else { + // Note difference in JS behavior + assertValidType(0.toShort, SInt) } - assertTrue(0, SInt) + assertValidType(0, SInt) if (Environment.current.isJVM) { - assertFalse(0, SShort) - } else { // JS - assertTrue(0, SShort) + assertInvalidType(0, SShort) + } else { + // Note difference in JS behavior + assertValidType(0, SShort) } - assertTrue(0L, SLong) - assertFalse(0L, SShort) + assertValidType(0L, SLong) + assertInvalidType(0L, SShort) - assertTrue(BigIntZero, SBigInt) - assertFalse(BigIntZero, SShort) + assertValidType(BigIntZero, SBigInt) + assertInvalidType(BigIntZero, SShort) - assertTrue(ge1, SGroupElement) - assertFalse(ge1, SShort) + assertValidType(ge1, SGroupElement) + assertInvalidType(ge1, SShort) - assertTrue(CSigmaProp(create_dlog()), SSigmaProp) - assertFalse(CSigmaProp(create_dlog()), SShort) + assertValidType(CSigmaProp(create_dlog()), SSigmaProp) + assertInvalidType(CSigmaProp(create_dlog()), SShort) - assertTrue(b1, SBox) - assertFalse(b1, SShort) + assertValidType(b1, SBox) + assertInvalidType(b1, SShort) val coll = Coll[Int](1, 2) - assertTrue(coll, SCollection(SInt)) - assertFalse(coll, SShort) - assertTrue(Coll[Long](1L), SCollection(SInt)) // because type check is shallow + assertValidType(coll, SCollection(SInt)) + assertInvalidType(coll, SShort) + assertValidType(Coll[Long](1L), SCollection(SInt)) // because type check is shallow - assertTrue(None, SOption(SInt)) - assertTrue(Some(10), SOption(SInt)) - assertTrue(Some(10), SOption(SLong)) // because type check is shallow - assertFalse(None, SShort) - assertFalse(Some(10), SShort) + assertValidType(None, SOption(SInt)) + assertValidType(Some(10), SOption(SInt)) + assertValidType(Some(10), SOption(SLong)) // because type check is shallow + assertInvalidType(None, SShort) + assertInvalidType(Some(10), SShort) val ctx = fakeContext.toSigmaContext() - assertTrue(ctx, SContext) - assertFalse(ctx, SShort) + assertValidType(ctx, SContext) + assertInvalidType(ctx, SShort) - assertTrue(t1, SAvlTree) - assertFalse(t1, SShort) + assertValidType(t1, SAvlTree) + assertInvalidType(t1, SShort) - assertTrue(CostingSigmaDslBuilder, SGlobal) - assertFalse(CostingSigmaDslBuilder, SShort) + assertValidType(CostingSigmaDslBuilder, SGlobal) + assertInvalidType(CostingSigmaDslBuilder, SShort) - assertTrue(h1, SHeader) - assertFalse(h1, SShort) + assertValidType(h1, SHeader) + assertInvalidType(h1, SShort) - assertTrue(preH1, SPreHeader) - assertFalse(preH1, SShort) + assertValidType(preH1, SPreHeader) + assertInvalidType(preH1, SShort) - assertTrue((1, 1L), STuple(SInt, SLong)) - assertTrue((1, 1L), STuple(SInt, SInt)) // because type check is shallow - assertTrue((1, Some(1)), STuple(SInt, SOption(SLong))) // because type check is shallow + assertValidType((1, 1L), STuple(SInt, SLong)) + assertValidType((1, 1L), STuple(SInt, SInt)) // because type check is shallow + assertValidType((1, Some(1)), STuple(SInt, SOption(SLong))) // because type check is shallow assertExceptionThrown( - assertTrue((1, 1L, Some(1)), STuple(SInt, SLong, SOption(SInt))), + assertValidType((1, 1L, Some(1)), STuple(SInt, SLong, SOption(SInt))), exceptionLike[RuntimeException](s"Unsupported tuple type") ) - assertTrue((x: Any) => x, SFunc(SInt, SLong)) // note, arg and result types not checked - assertFalse((x: Any) => x, STuple(SInt, SLong)) - assertFalse(1, SFunc(SInt, SLong)) + assertValidType((x: Any) => x, SFunc(SInt, SLong)) // note, arg and result types not checked + assertInvalidType((x: Any) => x, STuple(SInt, SLong)) + assertInvalidType(1, SFunc(SInt, SLong)) assertExceptionThrown( - assertTrue((x: Any) => x, SFunc(Array(SInt, SLong), SOption(SInt))), + assertValidType((x: Any) => x, SFunc(Array(SInt, SLong), SOption(SInt))), exceptionLike[RuntimeException](s"Unsupported function type") ) assertExceptionThrown( - assertTrue("", SString), + assertValidType("", SString), exceptionLike[RuntimeException](s"Unknown type") ) } diff --git a/sc/shared/src/test/scala/sigmastate/utxo/BasicOpsSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/BasicOpsSpecification.scala index 2b5e906a43..9372a59e5e 100644 --- a/sc/shared/src/test/scala/sigmastate/utxo/BasicOpsSpecification.scala +++ b/sc/shared/src/test/scala/sigmastate/utxo/BasicOpsSpecification.scala @@ -47,6 +47,7 @@ class BasicOpsSpecification extends CompilerTestingCommons (byteVar1, ByteConstant(1)), (byteVar2, ByteConstant(2)), (bigIntVar1, BigIntConstant(BigInt(10).underlying())), (bigIntVar2, BigIntConstant(BigInt(20).underlying())), (booleanVar, TrueLeaf)) + // to support both JVM and JS we need to wrap numeric values into CAnyValue val env = Map( "intVar1" -> CAnyValue(intVar1), "intVar2" -> CAnyValue(intVar2), "byteVar1" -> CAnyValue(byteVar1), "byteVar2" -> CAnyValue(byteVar2), "byteVar3" -> CAnyValue(byteVar3), diff --git a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Isos.scala b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Isos.scala index 1184602482..b0ad838cf2 100644 --- a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Isos.scala +++ b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Isos.scala @@ -370,7 +370,6 @@ object Isos { } val isoBox: Iso[Box[commonMod.Amount], ErgoBox] = new Iso[Box[commonMod.Amount], ErgoBox] { -// import sigmastate.eval._ override def to(x: Box[commonMod.Amount]): ErgoBox = { val ergoBox = new ErgoBox( value = isoAmount.to(x.value), diff --git a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/SigmaProp.scala b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/SigmaProp.scala index f0e8504e1e..0722b68e5a 100644 --- a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/SigmaProp.scala +++ b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/SigmaProp.scala @@ -4,6 +4,6 @@ import sigmastate.Values.SigmaBoolean import scala.scalajs.js import scala.scalajs.js.annotation.JSExportTopLevel -/** Equivalent of [[special.sigma.Header]] available from JS. */ +/** Equivalent of [[special.sigma.SigmaProp]] available from JS. */ @JSExportTopLevel("SigmaProp") class SigmaProp(val sigmaBoolean: SigmaBoolean) extends js.Object From 72baa09432c1e21872bd1034e949dde133fecccf Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Tue, 18 Jul 2023 20:05:37 +0200 Subject: [PATCH 51/58] v5.0.10-RC: change type of AvlTreeData.digest --- .../src/main/scala/scalan/OverloadHack.scala | 6 +-- .../src/main/scala/sigmastate/Platform.scala | 2 +- .../org/ergoplatform/ErgoLikeContext.scala | 4 +- .../org/ergoplatform/dsl/AvlTreeHelpers.scala | 2 +- .../main/scala/sigmastate/AvlTreeData.scala | 29 ++++--------- .../sigmastate/eval/CostingDataContext.scala | 13 +++--- .../serialization/AvlTreeSpecification.scala | 2 +- .../generators/ObjectGenerators.scala | 43 ++++++++++--------- .../special/sigma/SigmaTestingData.scala | 10 ++--- .../scala/sigmastate/lang/syntax/Core.scala | 1 - .../sigmastate/helpers/SigmaPPrintSpec.scala | 3 +- .../sigmastate/utils/GenPredefFuncsApp.scala | 2 +- .../sigmastate/utils/GenSerializers.scala | 4 +- .../sigmastate/ErgoTreeSpecification.scala | 10 ++--- .../scala/sigmastate/FailingToProveSpec.scala | 2 +- .../ScriptVersionSwitchSpecification.scala | 4 +- .../SoftForkabilitySpecification.scala | 2 +- .../TestingInterpreterSpecification.scala | 4 +- .../sigmastate/eval/ErgoScriptTestkit.scala | 4 +- .../DeserializationResilience.scala | 2 +- .../utxo/AVLTreeScriptsSpecification.scala | 10 ++--- .../BlockchainSimulationTestingCommons.scala | 4 +- .../AssetsAtomicExchangeErgoTests.scala | 2 +- .../examples/FsmExampleSpecification.scala | 2 +- .../sigmastate/utxo/examples/IcoExample.scala | 15 ++++--- .../utxo/examples/LetsSpecification.scala | 7 +-- .../examples/MASTExampleSpecification.scala | 7 +-- .../OracleExamplesSpecification.scala | 14 +++--- .../special/sigma/SigmaDslSpecification.scala | 8 ++-- .../scala/org/ergoplatform/sdk/js/Isos.scala | 2 +- .../sdk/AppkitProvingInterpreter.scala | 12 +++--- .../org/ergoplatform/sdk/JsonCodecs.scala | 2 +- .../sdk/ReducingInterpreter.scala | 2 +- .../org/ergoplatform/sdk/SecretString.scala | 2 +- .../org/ergoplatform/sdk/utils/Zero.scala | 13 +++--- 35 files changed, 116 insertions(+), 135 deletions(-) diff --git a/common/shared/src/main/scala/scalan/OverloadHack.scala b/common/shared/src/main/scala/scalan/OverloadHack.scala index 7905b9604e..81d92e6f0f 100644 --- a/common/shared/src/main/scala/scalan/OverloadHack.scala +++ b/common/shared/src/main/scala/scalan/OverloadHack.scala @@ -12,7 +12,7 @@ object OverloadHack { class Overloaded1 extends Overloaded { override def toString = "O1"} class Overloaded2 extends Overloaded { override def toString = "O2"} class Overloaded3 extends Overloaded { override def toString = "O3"} - implicit val overloaded1 = new Overloaded1 - implicit val overloaded2 = new Overloaded2 - implicit val overloaded3 = new Overloaded3 + implicit val overloaded1: Overloaded1 = new Overloaded1 + implicit val overloaded2: Overloaded2 = new Overloaded2 + implicit val overloaded3: Overloaded3 = new Overloaded3 } \ No newline at end of file diff --git a/interpreter/jvm/src/main/scala/sigmastate/Platform.scala b/interpreter/jvm/src/main/scala/sigmastate/Platform.scala index abfc3ad261..f094e290b8 100644 --- a/interpreter/jvm/src/main/scala/sigmastate/Platform.scala +++ b/interpreter/jvm/src/main/scala/sigmastate/Platform.scala @@ -6,7 +6,7 @@ import sigmastate.Values.{Constant, FalseLeaf, SigmaBoolean, TrueLeaf} import sigmastate.eval.{Evaluation, SigmaDsl} import sigmastate.lang.SigmaBuilder import special.collection.Coll -import special.sigma.{AnyValue, AvlTree, GroupElement, SigmaProp} +import special.sigma.{AvlTree, GroupElement, SigmaProp} import java.math.BigInteger diff --git a/interpreter/shared/src/main/scala/org/ergoplatform/ErgoLikeContext.scala b/interpreter/shared/src/main/scala/org/ergoplatform/ErgoLikeContext.scala index 17ed46449d..3bf455ae6f 100644 --- a/interpreter/shared/src/main/scala/org/ergoplatform/ErgoLikeContext.scala +++ b/interpreter/shared/src/main/scala/org/ergoplatform/ErgoLikeContext.scala @@ -85,11 +85,11 @@ class ErgoLikeContext(val lastBlockUtxoRoot: AvlTreeData, Examined ergo code: all that leads to ErgoLikeContext creation. */ require(boxesToSpend.isDefinedAt(selfIndex), s"Self box if defined should be among boxesToSpend") - require(headers.toArray.headOption.forall(h => java.util.Arrays.equals(h.stateRoot.digest.toArray, lastBlockUtxoRoot.digest)), "Incorrect lastBlockUtxoRoot") + require(headers.isEmpty || headers(0).stateRoot.digest == lastBlockUtxoRoot.digest, "Incorrect lastBlockUtxoRoot") cfor(0)(_ < headers.length, _ + 1) { i => if (i > 0) require(headers(i - 1).parentId == headers(i).id, s"Incorrect chain: ${headers(i - 1).parentId},${headers(i).id}") } - require(headers.toArray.headOption.forall(_.id == preHeader.parentId), s"preHeader.parentId should be id of the best header") + require(headers.isEmpty || headers(0).id == preHeader.parentId, s"preHeader.parentId should be id of the best header") /* NOHF PROOF: Added: assert that dataBoxes corresponds to spendingTransaction.dataInputs Motivation: to fail early, rather than when going into evaluation diff --git a/interpreter/shared/src/main/scala/org/ergoplatform/dsl/AvlTreeHelpers.scala b/interpreter/shared/src/main/scala/org/ergoplatform/dsl/AvlTreeHelpers.scala index 9e877a104e..31eadc836c 100644 --- a/interpreter/shared/src/main/scala/org/ergoplatform/dsl/AvlTreeHelpers.scala +++ b/interpreter/shared/src/main/scala/org/ergoplatform/dsl/AvlTreeHelpers.scala @@ -20,7 +20,7 @@ object AvlTreeHelpers { if (!ok) throw new Exception("Test tree generation failed") val _ = avlProver.generateProof() val digest = avlProver.digest - val treeData = new AvlTreeData(digest, flags, 32, None) + val treeData = new AvlTreeData(Colls.fromArray(digest), flags, 32, None) (CAvlTree(treeData), avlProver) } diff --git a/interpreter/shared/src/main/scala/sigmastate/AvlTreeData.scala b/interpreter/shared/src/main/scala/sigmastate/AvlTreeData.scala index 2f07156c0e..6533aa857c 100644 --- a/interpreter/shared/src/main/scala/sigmastate/AvlTreeData.scala +++ b/interpreter/shared/src/main/scala/sigmastate/AvlTreeData.scala @@ -1,10 +1,10 @@ package sigmastate -import java.util.{Arrays, Objects} -import scorex.crypto.authds.ADDigest import sigmastate.basics.CryptoConstants +import sigmastate.eval.Colls import sigmastate.serialization.SigmaSerializer import sigmastate.utils.{SigmaByteReader, SigmaByteWriter} +import special.collection.Coll case class AvlTreeFlags(insertAllowed: Boolean, updateAllowed: Boolean, removeAllowed: Boolean) { @@ -51,35 +51,22 @@ object AvlTreeFlags { * @param valueLengthOpt - if non-empty, all the values under the tree are of the same length */ -case class AvlTreeData(digest: ADDigest, +case class AvlTreeData(digest: Coll[Byte], treeFlags: AvlTreeFlags, keyLength: Int, - valueLengthOpt: Option[Int] = None) { - override def equals(arg: Any): Boolean = arg match { - case x: AvlTreeData => - Arrays.equals(digest, x.digest) && - keyLength == x.keyLength && - valueLengthOpt == x.valueLengthOpt && - treeFlags == x.treeFlags - case _ => false - } - - override def hashCode(): Int = - (Arrays.hashCode(digest) * 31 + - keyLength.hashCode()) * 31 + Objects.hash(valueLengthOpt, treeFlags) -} + valueLengthOpt: Option[Int] = None) object AvlTreeData { val DigestSize: Int = CryptoConstants.hashLength + 1 //please read class comments above for details val TreeDataSize = DigestSize + 3 + 4 + 4 val dummy = new AvlTreeData( - ADDigest @@ Array.fill(DigestSize)(0:Byte), + Colls.fromArray(Array.fill(DigestSize)(0:Byte)), AvlTreeFlags.AllOperationsAllowed, keyLength = 32) /** Create [[AvlTreeData]] with the given digest and all operations enabled. */ - def avlTreeFromDigest(digest: ADDigest): AvlTreeData = { + def avlTreeFromDigest(digest: Coll[Byte]): AvlTreeData = { val flags = AvlTreeFlags(insertAllowed = true, updateAllowed = true, removeAllowed = true) AvlTreeData(digest, flags, CryptoConstants.hashLength) } @@ -88,7 +75,7 @@ object AvlTreeData { override def serialize(data: AvlTreeData, w: SigmaByteWriter): Unit = { val tf = AvlTreeFlags.serializeFlags(data.treeFlags) - w.putBytes(data.digest) + w.putBytes(data.digest.toArray) .putUByte(tf) .putUInt(data.keyLength) .putOption(data.valueLengthOpt)(_.putUInt(_)) @@ -102,7 +89,7 @@ object AvlTreeData { // Note, when keyLength and valueLengthOpt < 0 as a result of Int overflow, // the deserializer succeeds with invalid AvlTreeData // but still some AvlTree operations (remove_eval, update_eval, contains_eval) won't throw - AvlTreeData(ADDigest @@ digest, tf, keyLength, valueLengthOpt) + AvlTreeData(Colls.fromArray(digest), tf, keyLength, valueLengthOpt) } } } diff --git a/interpreter/shared/src/main/scala/sigmastate/eval/CostingDataContext.scala b/interpreter/shared/src/main/scala/sigmastate/eval/CostingDataContext.scala index 5ed332f3ba..f7679573d6 100644 --- a/interpreter/shared/src/main/scala/sigmastate/eval/CostingDataContext.scala +++ b/interpreter/shared/src/main/scala/sigmastate/eval/CostingDataContext.scala @@ -1,7 +1,7 @@ package sigmastate.eval import debox.cfor -import org.ergoplatform.validation.ValidationRules +import org.ergoplatform.validation.{SigmaValidationSettings, ValidationRules} import org.ergoplatform.{ErgoBox, SigmaConstants} import scalan.OverloadHack.Overloaded1 import scalan.RType @@ -193,17 +193,17 @@ case class CAvlTree(treeData: AvlTreeData) extends AvlTree with WrapperOf[AvlTre override def valueLengthOpt: Option[Int] = treeData.valueLengthOpt - override def digest: Coll[Byte] = Colls.fromArray(treeData.digest) + override def digest: Coll[Byte] = treeData.digest override def updateDigest(newDigest: Coll[Byte]): AvlTree = { - val td = treeData.copy(digest = ADDigest @@ newDigest.toArray) + val td = treeData.copy(digest = newDigest) this.copy(treeData = td) } override def createVerifier(proof: Coll[Byte]): AvlTreeVerifier = { val adProof = SerializedAdProof @@ proof.toArray val bv = new CAvlTreeVerifier( - treeData.digest, adProof, treeData.keyLength, treeData.valueLengthOpt) + ADDigest @@ treeData.digest.toArray, adProof, treeData.keyLength, treeData.valueLengthOpt) bv } @@ -491,7 +491,7 @@ object CHeader { * @see [[SigmaDslBuilder]] for detailed descriptions */ class CostingSigmaDslBuilder extends SigmaDslBuilder { dsl => - implicit val validationSettings = ValidationRules.currentSettings + implicit val validationSettings: SigmaValidationSettings = ValidationRules.currentSettings // manual fix override val Colls: CollBuilder = new CollOverArrayBuilder @@ -522,7 +522,7 @@ class CostingSigmaDslBuilder extends SigmaDslBuilder { dsl => * @see AvlTreeData for details */ override def avlTree(operationFlags: Byte, digest: Coll[Byte], keyLength: Int, valueLengthOpt: Option[Int]): CAvlTree = { - val treeData = AvlTreeData(ADDigest @@ digest.toArray, AvlTreeFlags(operationFlags), keyLength, valueLengthOpt) + val treeData = AvlTreeData(digest, AvlTreeFlags(operationFlags), keyLength, valueLengthOpt) CAvlTree(treeData) } @@ -712,6 +712,7 @@ case class CostingDataContext( } override def getVar[T](id: Byte)(implicit tT: RType[T]): Option[T] = { + @unused // avoid warning about unused ctA implicit val tag: ClassTag[T] = tT.classTag if (id < 0 || id >= vars.length) return None val value = vars(id) diff --git a/interpreter/shared/src/test/scala/sigmastate/serialization/AvlTreeSpecification.scala b/interpreter/shared/src/test/scala/sigmastate/serialization/AvlTreeSpecification.scala index ed3382fa10..42c71278ef 100644 --- a/interpreter/shared/src/test/scala/sigmastate/serialization/AvlTreeSpecification.scala +++ b/interpreter/shared/src/test/scala/sigmastate/serialization/AvlTreeSpecification.scala @@ -40,7 +40,7 @@ class AvlTreeSpecification extends SerializationSpecification { val digest = avlProver.digest val flags = AvlTreeFlags(true, false, false) - val treeData = new AvlTreeData(digest, flags, 32, None) + val treeData = new AvlTreeData(Colls.fromArray(digest), flags, 32, None) val tree = SigmaDsl.avlTree(treeData) val k = Blake2b256.hash("1") diff --git a/interpreter/shared/src/test/scala/sigmastate/serialization/generators/ObjectGenerators.scala b/interpreter/shared/src/test/scala/sigmastate/serialization/generators/ObjectGenerators.scala index 9bce0f0246..0e15cd525e 100644 --- a/interpreter/shared/src/test/scala/sigmastate/serialization/generators/ObjectGenerators.scala +++ b/interpreter/shared/src/test/scala/sigmastate/serialization/generators/ObjectGenerators.scala @@ -17,7 +17,7 @@ import sigmastate.basics.DLogProtocol.ProveDlog import sigmastate.basics.{CryptoConstants, ProveDHTuple} import sigmastate.eval.Extensions._ import sigmastate.eval.{CostingBox, SigmaDsl, _} -import sigmastate.basics.CryptoConstants.EcPointType +import sigmastate.basics.CryptoConstants.{EcPointType, dlogGroup} import sigmastate.interpreter.{ContextExtension, ProverResult} import sigmastate.lang.TransformingSigmaBuilder._ import sigmastate._ @@ -25,6 +25,7 @@ import sigmastate.utxo._ import special.collection.Coll import special.sigma._ +import java.math.BigInteger import scala.collection.compat.immutable.ArraySeq import scala.collection.mutable.ListBuffer import scala.reflect.ClassTag @@ -75,25 +76,25 @@ trait ObjectGenerators extends TypeGenerators implicit lazy val arbProveDlog: Arbitrary[ProveDlog] = Arbitrary(proveDlogGen) implicit lazy val arbProveDHT: Arbitrary[ProveDHTuple] = Arbitrary(proveDHTGen) implicit lazy val arbRegisterIdentifier: Arbitrary[RegisterId] = Arbitrary(registerIdentifierGen) - implicit lazy val arbBigInteger = Arbitrary(Arbitrary.arbBigInt.arbitrary.map(_.bigInteger)) - implicit lazy val arbBigInt = Arbitrary(arbBigInteger.arbitrary.map(SigmaDsl.BigInt(_))) - implicit lazy val arbEcPointType = Arbitrary(Gen.const(()).flatMap(_ => CryptoConstants.dlogGroup.createRandomGenerator())) - implicit lazy val arbGroupElement = Arbitrary(arbEcPointType.arbitrary.map(SigmaDsl.GroupElement(_))) + implicit lazy val arbBigInteger: Arbitrary[BigInteger] = Arbitrary(Arbitrary.arbBigInt.arbitrary.map(_.bigInteger)) + implicit lazy val arbBigInt: Arbitrary[BigInt] = Arbitrary(arbBigInteger.arbitrary.map(SigmaDsl.BigInt(_))) + implicit lazy val arbEcPointType: Arbitrary[dlogGroup.ElemType] = Arbitrary(Gen.const(()).flatMap(_ => CryptoConstants.dlogGroup.createRandomGenerator())) + implicit lazy val arbGroupElement: Arbitrary[GroupElement] = Arbitrary(arbEcPointType.arbitrary.map(SigmaDsl.GroupElement(_))) implicit lazy val arbSigmaBoolean: Arbitrary[SigmaBoolean] = Arbitrary(Gen.oneOf(proveDHTGen, proveDHTGen)) implicit lazy val arbSigmaProp: Arbitrary[SigmaProp] = Arbitrary(sigmaPropGen) implicit lazy val arbSigmaPropValue: Arbitrary[SigmaPropValue] = Arbitrary(sigmaPropValueGen) - implicit lazy val arbErgoBox = Arbitrary(ergoBoxGen) - implicit lazy val arbBox = Arbitrary(ergoBoxGen.map(SigmaDsl.Box)) - implicit lazy val arbAvlTreeData = Arbitrary(avlTreeDataGen) - implicit lazy val arbAvlTree = Arbitrary(avlTreeGen) - implicit lazy val arbBoxCandidate = Arbitrary(ergoBoxCandidateGen(tokensGen.sample.get)) - implicit lazy val arbTransaction = Arbitrary(ergoTransactionGen) - implicit lazy val arbContextExtension = Arbitrary(contextExtensionGen) - implicit lazy val arbSerializedProverResult = Arbitrary(serializedProverResultGen) - implicit lazy val arbUnsignedInput = Arbitrary(unsignedInputGen) - implicit lazy val arbDataInput = Arbitrary(dataInputGen) - implicit lazy val arbInput = Arbitrary(inputGen) - implicit lazy val arbUnsignedErgoLikeTransaction = Arbitrary(unsignedErgoLikeTransactionGen) + implicit lazy val arbErgoBox: Arbitrary[ErgoBox] = Arbitrary(ergoBoxGen) + implicit lazy val arbBox: Arbitrary[Box] = Arbitrary(ergoBoxGen.map(SigmaDsl.Box)) + implicit lazy val arbAvlTreeData: Arbitrary[AvlTreeData] = Arbitrary(avlTreeDataGen) + implicit lazy val arbAvlTree: Arbitrary[AvlTree] = Arbitrary(avlTreeGen) + implicit lazy val arbBoxCandidate: Arbitrary[ErgoBoxCandidate] = Arbitrary(ergoBoxCandidateGen(tokensGen.sample.get)) + implicit lazy val arbTransaction: Arbitrary[ErgoLikeTransaction] = Arbitrary(ergoTransactionGen) + implicit lazy val arbContextExtension: Arbitrary[ContextExtension] = Arbitrary(contextExtensionGen) + implicit lazy val arbSerializedProverResult: Arbitrary[ProverResult] = Arbitrary(serializedProverResultGen) + implicit lazy val arbUnsignedInput: Arbitrary[UnsignedInput] = Arbitrary(unsignedInputGen) + implicit lazy val arbDataInput: Arbitrary[DataInput] = Arbitrary(dataInputGen) + implicit lazy val arbInput: Arbitrary[Input] = Arbitrary(inputGen) + implicit lazy val arbUnsignedErgoLikeTransaction: Arbitrary[UnsignedErgoLikeTransaction] = Arbitrary(unsignedErgoLikeTransactionGen) def arrayOfN[T](n: Int, g: Gen[T]) (implicit evb: Buildable[T, Array[T]]): Gen[Array[T]] = { @@ -286,7 +287,7 @@ trait ObjectGenerators extends TypeGenerators flags <- avlTreeFlagsGen keyLength <- unsignedIntGen vl <- arbOption[Int](Arbitrary(unsignedIntGen)).arbitrary - } yield AvlTreeData(ADDigest @@@ digest, flags, keyLength, vl) + } yield AvlTreeData(Colls.fromArray(digest), flags, keyLength, vl) def avlTreeGen: Gen[AvlTree] = avlTreeDataGen.map(SigmaDsl.avlTree) @@ -709,7 +710,7 @@ trait ObjectGenerators extends TypeGenerators header <- headerGen(stateRoot, parentId) } yield header - implicit lazy val arbHeader = Arbitrary(headerGen) + implicit lazy val arbHeader: Arbitrary[Header] = Arbitrary(headerGen) val MaxHeaders = 2 def headersGen(stateRoot: AvlTree): Gen[Seq[Header]] = for { @@ -738,7 +739,7 @@ trait ObjectGenerators extends TypeGenerators preHeader <- preHeaderGen(parentId) } yield preHeader - implicit lazy val arbPreHeader = Arbitrary(preHeaderGen) + implicit lazy val arbPreHeader: Arbitrary[PreHeader] = Arbitrary(preHeaderGen) lazy val ergoLikeTransactionGen: Gen[ErgoLikeTransaction] = for { inputBoxesIds <- Gen.nonEmptyListOf(boxIdGen) @@ -796,7 +797,7 @@ trait ObjectGenerators extends TypeGenerators ergoLikeTransactionGen(boxesToSpend.map(_.id), dataBoxes.map(_.id)) ) } yield new ErgoLikeContext( - lastBlockUtxoRoot = AvlTreeData(ADDigest @@ stateRoot.digest.toArray, avlTreeFlags, unsignedIntGen.sample.get), + lastBlockUtxoRoot = AvlTreeData(stateRoot.digest, avlTreeFlags, unsignedIntGen.sample.get), headers = headers.toColl, preHeader = preHeader, dataBoxes = dataBoxes.toIndexedSeq, diff --git a/interpreter/shared/src/test/scala/special/sigma/SigmaTestingData.scala b/interpreter/shared/src/test/scala/special/sigma/SigmaTestingData.scala index 193282929f..3838ac87d2 100644 --- a/interpreter/shared/src/test/scala/special/sigma/SigmaTestingData.scala +++ b/interpreter/shared/src/test/scala/special/sigma/SigmaTestingData.scala @@ -179,7 +179,7 @@ trait SigmaTestingData extends TestingCommons with ObjectGenerators { val t1_instances = new CloneSet(1000, CAvlTree( AvlTreeData( - ADDigest @@ ErgoAlgos.decodeUnsafe("000183807f66b301530120ff7fc6bd6601ff01ff7f7d2bedbbffff00187fe89094"), + ErgoAlgos.decodeUnsafe("000183807f66b301530120ff7fc6bd6601ff01ff7f7d2bedbbffff00187fe89094").toColl, AvlTreeFlags(false, true, true), 1, Some(1) @@ -192,7 +192,7 @@ trait SigmaTestingData extends TestingCommons with ObjectGenerators { val t2: AvlTree = CAvlTree( AvlTreeData( - ADDigest @@ ErgoAlgos.decodeUnsafe("ff000d937f80ffd731ed802d24358001ff8080ff71007f00ad37e0a7ae43fff95b"), + ErgoAlgos.decodeUnsafe("ff000d937f80ffd731ed802d24358001ff8080ff71007f00ad37e0a7ae43fff95b").toColl, AvlTreeFlags(false, false, false), 32, Some(64) @@ -201,7 +201,7 @@ trait SigmaTestingData extends TestingCommons with ObjectGenerators { val t3: AvlTree = CAvlTree( AvlTreeData( - ADDigest @@ ErgoAlgos.decodeUnsafe("3100d2e101ff01fc047c7f6f00ff80129df69a5090012f01ffca99f5bfff0c8036"), + ErgoAlgos.decodeUnsafe("3100d2e101ff01fc047c7f6f00ff80129df69a5090012f01ffca99f5bfff0c8036").toColl, AvlTreeFlags(true, false, false), 128, None @@ -302,9 +302,7 @@ trait SigmaTestingData extends TestingCommons with ObjectGenerators { val preH2: PreHeader = create_preH1().asInstanceOf[CPreHeader].copy(height = 2) def createAvlTreeData() = AvlTreeData( - ADDigest @@ ( - ErgoAlgos.decodeUnsafe("010180017f7f7b7f720c00007f7f7f0f01e857a626f37f1483d06af8077a008080") - ), + ErgoAlgos.decodeUnsafe("010180017f7f7b7f720c00007f7f7f0f01e857a626f37f1483d06af8077a008080").toColl, AvlTreeFlags(false, true, false), 728138553, Some(2147483647) diff --git a/parsers/shared/src/main/scala/sigmastate/lang/syntax/Core.scala b/parsers/shared/src/main/scala/sigmastate/lang/syntax/Core.scala index 2a6c407693..05f0952b20 100644 --- a/parsers/shared/src/main/scala/sigmastate/lang/syntax/Core.scala +++ b/parsers/shared/src/main/scala/sigmastate/lang/syntax/Core.scala @@ -1,6 +1,5 @@ package sigmastate.lang.syntax -import scala.language.implicitConversions import sigmastate._ import sigmastate.Values._ import sigmastate.lang.syntax diff --git a/sc/jvm/src/test/scala/sigmastate/helpers/SigmaPPrintSpec.scala b/sc/jvm/src/test/scala/sigmastate/helpers/SigmaPPrintSpec.scala index b990c1d751..bb41b44418 100644 --- a/sc/jvm/src/test/scala/sigmastate/helpers/SigmaPPrintSpec.scala +++ b/sc/jvm/src/test/scala/sigmastate/helpers/SigmaPPrintSpec.scala @@ -3,7 +3,6 @@ package sigmastate.helpers import org.ergoplatform.settings.ErgoAlgos import org.ergoplatform.{ErgoBox, Outputs} import scalan.RType -import scorex.crypto.authds.ADDigest import scorex.util.ModifierId import sigmastate.Values._ import sigmastate._ @@ -74,7 +73,7 @@ class SigmaPPrintSpec extends SigmaDslTesting { test(Helpers.decodeECPoint(ge1), s"""Helpers.decodeECPoint("${ge1}")""") val t1 = AvlTreeData( - ADDigest @@ ErgoAlgos.decodeUnsafe("000183807f66b301530120ff7fc6bd6601ff01ff7f7d2bedbbffff00187fe89094"), + ErgoAlgos.decodeUnsafe("000183807f66b301530120ff7fc6bd6601ff01ff7f7d2bedbbffff00187fe89094").toColl, AvlTreeFlags(false, true, true), 1, Some(1) diff --git a/sc/jvm/src/test/scala/sigmastate/utils/GenPredefFuncsApp.scala b/sc/jvm/src/test/scala/sigmastate/utils/GenPredefFuncsApp.scala index 3343e28642..3fffe59784 100644 --- a/sc/jvm/src/test/scala/sigmastate/utils/GenPredefFuncsApp.scala +++ b/sc/jvm/src/test/scala/sigmastate/utils/GenPredefFuncsApp.scala @@ -18,7 +18,7 @@ object GenPredefFuncsApp extends SpecGen { val funcRows = StringBuilder.newBuilder val sections = StringBuilder.newBuilder - for (row @ (d, f, info) <- opInfos) { + for ((d, f, info) <- opInfos) { val opCode = toDisplayCode(d.opCode) val mnemonic = d.typeName val opName = toTexName(f.name) diff --git a/sc/jvm/src/test/scala/sigmastate/utils/GenSerializers.scala b/sc/jvm/src/test/scala/sigmastate/utils/GenSerializers.scala index c55c300d4a..470baf27e8 100644 --- a/sc/jvm/src/test/scala/sigmastate/utils/GenSerializers.scala +++ b/sc/jvm/src/test/scala/sigmastate/utils/GenSerializers.scala @@ -116,7 +116,7 @@ object GenSerializers extends SpecGen { def printSerScopeSlots(serScope: SerScope) = { val rows = StringBuilder.newBuilder openRow = false - serScope.children.map { case (name, scope) => + serScope.children.map { case (_, scope) => printScope(scope, 0, rows) } rows.result() @@ -138,7 +138,7 @@ object GenSerializers extends SpecGen { val desc = opInfo.map(_.description) val opRef = opRow .filterNot { case (d,_,_) => d == PropertyCall || d == MethodCall } - .opt { case (d, m, f) => + .opt { case (_, m, f) => m.fold(f.opt { f => val refName = f.docInfo.opTypeName val opName = f.name.replace("%", "\\%") diff --git a/sc/shared/src/test/scala/sigmastate/ErgoTreeSpecification.scala b/sc/shared/src/test/scala/sigmastate/ErgoTreeSpecification.scala index 5dabf9974d..d76f54e6e8 100644 --- a/sc/shared/src/test/scala/sigmastate/ErgoTreeSpecification.scala +++ b/sc/shared/src/test/scala/sigmastate/ErgoTreeSpecification.scala @@ -11,9 +11,9 @@ import sigmastate.VersionContext._ import sigmastate.eval.{CostingBox, Evaluation, Profiler} import sigmastate.exceptions.{CostLimitException, InterpreterException} import sigmastate.helpers.{ErgoLikeContextTesting, SigmaPPrint} -import sigmastate.interpreter.ErgoTreeEvaluator +import sigmastate.interpreter.{ErgoTreeEvaluator, EvalSettings} import sigmastate.interpreter.Interpreter.ReductionResult -import sigmastate.lang.SourceContext +import sigmastate.lang.{CompilerSettings, SourceContext} import sigmastate.lang.Terms._ import sigmastate.serialization.ErgoTreeSerializer.DefaultSerializer import sigmastate.utils.Helpers.TryOps @@ -419,9 +419,9 @@ class ErgoTreeSpecification extends SigmaDslTesting with ContractsTestkit { } } - implicit def IR = new TestingIRContext - implicit def cs = compilerSettingsInTests - implicit def es = evalSettings + implicit def IR: TestingIRContext = new TestingIRContext + implicit def cs: CompilerSettings = compilerSettingsInTests + implicit def es: EvalSettings = evalSettings property("Apply with 0 arguments") { val expr = Apply(FuncValue(Vector(), IntConstant(1)), IndexedSeq()) diff --git a/sc/shared/src/test/scala/sigmastate/FailingToProveSpec.scala b/sc/shared/src/test/scala/sigmastate/FailingToProveSpec.scala index cbff4ca5f8..775785b709 100644 --- a/sc/shared/src/test/scala/sigmastate/FailingToProveSpec.scala +++ b/sc/shared/src/test/scala/sigmastate/FailingToProveSpec.scala @@ -10,7 +10,7 @@ import scala.util.Success class FailingToProveSpec extends CompilerTestingCommons with CompilerCrossVersionProps { - implicit lazy val IR = new TestingIRContext + implicit lazy val IR: TestingIRContext = new TestingIRContext /** * Both properties should work fine. * Currently the problem in first case is that even if we evaluate `withdrawCondition1 == true` diff --git a/sc/shared/src/test/scala/sigmastate/ScriptVersionSwitchSpecification.scala b/sc/shared/src/test/scala/sigmastate/ScriptVersionSwitchSpecification.scala index fe57c33f16..d73e81f56a 100644 --- a/sc/shared/src/test/scala/sigmastate/ScriptVersionSwitchSpecification.scala +++ b/sc/shared/src/test/scala/sigmastate/ScriptVersionSwitchSpecification.scala @@ -23,13 +23,13 @@ import special.sigma.{Box, SigmaDslTesting} * setup of activatedScriptVersion and ErgoTree.version. */ class ScriptVersionSwitchSpecification extends SigmaDslTesting { - override implicit val generatorDrivenConfig = PropertyCheckConfiguration(minSuccessful = 30) + override implicit val generatorDrivenConfig: PropertyCheckConfiguration = PropertyCheckConfiguration(minSuccessful = 30) override implicit val evalSettings: EvalSettings = ErgoTreeEvaluator.DefaultEvalSettings.copy( costTracingEnabled = true // should always be enabled in tests (and false by default) ) - implicit def IR = createIR() + implicit def IR: IRContext = createIR() lazy val b1 = CostingBox( new ErgoBox( diff --git a/sc/shared/src/test/scala/sigmastate/SoftForkabilitySpecification.scala b/sc/shared/src/test/scala/sigmastate/SoftForkabilitySpecification.scala index 05f892c2be..e671f503b0 100644 --- a/sc/shared/src/test/scala/sigmastate/SoftForkabilitySpecification.scala +++ b/sc/shared/src/test/scala/sigmastate/SoftForkabilitySpecification.scala @@ -26,7 +26,7 @@ class SoftForkabilitySpecification extends SigmaTestingData with CompilerTestingCommons with BeforeAndAfterAll { - implicit lazy val IR = new TestingIRContext + implicit lazy val IR: TestingIRContext = new TestingIRContext lazy val prover = new ErgoLikeTestProvingInterpreter() lazy val verifier = new ErgoLikeTestInterpreter val deadline = 100 diff --git a/sc/shared/src/test/scala/sigmastate/TestingInterpreterSpecification.scala b/sc/shared/src/test/scala/sigmastate/TestingInterpreterSpecification.scala index 76b4b63e50..51e6fd9556 100644 --- a/sc/shared/src/test/scala/sigmastate/TestingInterpreterSpecification.scala +++ b/sc/shared/src/test/scala/sigmastate/TestingInterpreterSpecification.scala @@ -20,7 +20,7 @@ import scala.util.Random class TestingInterpreterSpecification extends CompilerTestingCommons with CompilerCrossVersionProps with BeforeAndAfterAll { - implicit lazy val IR = new TestingIRContext + implicit lazy val IR: TestingIRContext = new TestingIRContext lazy val prover = new ErgoLikeTestProvingInterpreter() { } @@ -28,7 +28,7 @@ class TestingInterpreterSpecification extends CompilerTestingCommons lazy val verifier = new ErgoLikeTestInterpreter { } - implicit val soundness = CryptoConstants.soundnessBits + implicit val soundness: Int = CryptoConstants.soundnessBits def testingContext(h: Int) = ErgoLikeContextTesting(h, diff --git a/sc/shared/src/test/scala/sigmastate/eval/ErgoScriptTestkit.scala b/sc/shared/src/test/scala/sigmastate/eval/ErgoScriptTestkit.scala index efa0829d93..04230fdef9 100644 --- a/sc/shared/src/test/scala/sigmastate/eval/ErgoScriptTestkit.scala +++ b/sc/shared/src/test/scala/sigmastate/eval/ErgoScriptTestkit.scala @@ -15,7 +15,7 @@ import sigmastate.serialization.ErgoTreeSerializer.DefaultSerializer import sigmastate.{AvlTreeData, CompilerTestsBase, SType, VersionContext} import special.sigma.{ContractsTestkit, Context => DContext} -import scala.language.implicitConversions +import scala.annotation.unused import scala.util.Success trait ErgoScriptTestkit extends ContractsTestkit with LangTests @@ -195,7 +195,7 @@ trait ErgoScriptTestkit extends ContractsTestkit with LangTests tcase.doReduce() } - def build(env: ScriptEnv, name: String, script: String, expected: SValue): Unit = { + def build(env: ScriptEnv, @unused name: String, script: String, expected: SValue): Unit = { val tree = compile(env, script) tree shouldBe expected } diff --git a/sc/shared/src/test/scala/sigmastate/serialization/DeserializationResilience.scala b/sc/shared/src/test/scala/sigmastate/serialization/DeserializationResilience.scala index 0ebfbd16df..3a04397881 100644 --- a/sc/shared/src/test/scala/sigmastate/serialization/DeserializationResilience.scala +++ b/sc/shared/src/test/scala/sigmastate/serialization/DeserializationResilience.scala @@ -406,7 +406,7 @@ class DeserializationResilience extends DeserializationResilienceTesting { val avlProver = new BatchAVLProver[Digest32, Blake2b256.type](keyLength = 32, None) val digest = avlProver.digest val flags = AvlTreeFlags(true, false, false) - val treeData = new AvlTreeData(digest, flags, -1, None) + val treeData = new AvlTreeData(digest.toColl, flags, -1, None) val tree = SigmaDsl.avlTree(treeData) val k = Blake2b256.hash("1") val v = k diff --git a/sc/shared/src/test/scala/sigmastate/utxo/AVLTreeScriptsSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/AVLTreeScriptsSpecification.scala index 320877f1e8..9fd017eeae 100644 --- a/sc/shared/src/test/scala/sigmastate/utxo/AVLTreeScriptsSpecification.scala +++ b/sc/shared/src/test/scala/sigmastate/utxo/AVLTreeScriptsSpecification.scala @@ -158,7 +158,7 @@ class AVLTreeScriptsSpecification extends CompilerTestingCommons val (_, avlProver) = createAvlTree(AvlTreeFlags.AllOperationsAllowed, key -> value, genKey("key2") -> genValue("value2")) avlProver.performOneOperation(Lookup(genKey("key"))) - val digest = avlProver.digest + val digest = avlProver.digest.toColl val proof = avlProver.generateProof().toColl val treeData = SigmaDsl.avlTree(new AvlTreeData(digest, AvlTreeFlags.ReadOnly, 32, None)) @@ -197,7 +197,7 @@ class AVLTreeScriptsSpecification extends CompilerTestingCommons val digest = avlProver.digest val proof = avlProver.generateProof() - val treeData = new AvlTreeData(digest, AvlTreeFlags.ReadOnly, 32, None) + val treeData = new AvlTreeData(digest.toColl, AvlTreeFlags.ReadOnly, 32, None) val env = Map("key" -> key, "proof" -> proof) val prop = compile(env, """SELF.R4[AvlTree].get.contains(key, proof)""").asBoolValue.toSigmaProp @@ -235,7 +235,7 @@ class AVLTreeScriptsSpecification extends CompilerTestingCommons val avlProver = new BatchAVLProver[Digest32, Blake2b256.type](keyLength = 32, None) treeElements.foreach(s => avlProver.performOneOperation(Insert(s._1, s._2))) avlProver.generateProof() - val treeData = new AvlTreeData(avlProver.digest, AvlTreeFlags.ReadOnly, 32, None) + val treeData = new AvlTreeData(avlProver.digest.toColl, AvlTreeFlags.ReadOnly, 32, None) val proofId = 0: Byte val elementId = 1: Byte @@ -299,7 +299,7 @@ class AVLTreeScriptsSpecification extends CompilerTestingCommons val digest = avlProver.digest val proof = avlProver.generateProof() - val treeData = SigmaDsl.avlTree(new AvlTreeData(digest, AvlTreeFlags.ReadOnly, 32, None)) + val treeData = SigmaDsl.avlTree(new AvlTreeData(digest.toColl, AvlTreeFlags.ReadOnly, 32, None)) val proofId = 31: Byte @@ -366,7 +366,7 @@ class AVLTreeScriptsSpecification extends CompilerTestingCommons val verifier = new ErgoLikeTestInterpreter val pubkey = prover.dlogSecrets.head.publicImage - val treeData = SigmaDsl.avlTree(new AvlTreeData(digest, AvlTreeFlags.ReadOnly, 32, None)) + val treeData = SigmaDsl.avlTree(new AvlTreeData(digest.toColl, AvlTreeFlags.ReadOnly, 32, None)) val env = Map("proofId" -> proofId.toLong, "keys" -> ConcreteCollection.fromItems(genKey("3"), genKey("4"), genKey("5"))) diff --git a/sc/shared/src/test/scala/sigmastate/utxo/blockchain/BlockchainSimulationTestingCommons.scala b/sc/shared/src/test/scala/sigmastate/utxo/blockchain/BlockchainSimulationTestingCommons.scala index a70519112f..d22b706267 100644 --- a/sc/shared/src/test/scala/sigmastate/utxo/blockchain/BlockchainSimulationTestingCommons.scala +++ b/sc/shared/src/test/scala/sigmastate/utxo/blockchain/BlockchainSimulationTestingCommons.scala @@ -139,7 +139,7 @@ object BlockchainSimulationTestingCommons extends CompilerTestingCommons { assert(blockCost <= maxCost, s"Block cost $blockCost exceeds limit $maxCost") boxesReader.applyBlock(block) - val newState = BlockchainState(height, state.lastBlockUtxoRoot.copy(digest = boxesReader.digest)) + val newState = BlockchainState(height, state.lastBlockUtxoRoot.copy(digest = Colls.fromArray(boxesReader.digest))) ValidationState(newState, boxesReader, activatedVersion) } } @@ -165,7 +165,7 @@ object BlockchainSimulationTestingCommons extends CompilerTestingCommons { val keySize = 32 val prover = new BatchProver(keySize, None) - val digest = prover.digest + val digest = Colls.fromArray(prover.digest) val utxoRoot = AvlTreeData(digest, AvlTreeFlags.AllOperationsAllowed, keySize) val bs = BlockchainState(currentHeight = -2, utxoRoot) diff --git a/sc/shared/src/test/scala/sigmastate/utxo/examples/AssetsAtomicExchangeErgoTests.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/AssetsAtomicExchangeErgoTests.scala index 069b39e942..9a84f6cf1d 100644 --- a/sc/shared/src/test/scala/sigmastate/utxo/examples/AssetsAtomicExchangeErgoTests.scala +++ b/sc/shared/src/test/scala/sigmastate/utxo/examples/AssetsAtomicExchangeErgoTests.scala @@ -37,7 +37,7 @@ class AssetsAtomicExchangeErgoTests extends CompilerTestingCommons { suite => val (ergHolder, tokenHolder) = contract.startExchange(txCtx.block, buyerBox, sellerBox, 100, Token(contract.tokenId, 60)) // setup spending transaction - val (buyerTokens, sellerErgs) = contract.finishExchange(txCtx.block, ergHolder, tokenHolder) + val (buyerTokens, _) = contract.finishExchange(txCtx.block, ergHolder, tokenHolder) // ASSERT val input0 = buyerTokens.tx.inputs(0) diff --git a/sc/shared/src/test/scala/sigmastate/utxo/examples/FsmExampleSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/FsmExampleSpecification.scala index 9d11749d9b..99008b9e21 100644 --- a/sc/shared/src/test/scala/sigmastate/utxo/examples/FsmExampleSpecification.scala +++ b/sc/shared/src/test/scala/sigmastate/utxo/examples/FsmExampleSpecification.scala @@ -76,7 +76,7 @@ class FsmExampleSpecification extends CompilerTestingCommons avlProver.performOneOperation(Insert(ADKey @@ (transition30 ++ script4Hash), ADValue @@ Array.emptyByteArray)) avlProver.generateProof() - val digest = avlProver.digest + val digest = Colls.fromArray(avlProver.digest) val treeData = SigmaDsl.avlTree(new AvlTreeData(digest, AvlTreeFlags.ReadOnly, 34, Some(0))) val fsmDescRegister = ErgoBox.nonMandatoryRegisters.head diff --git a/sc/shared/src/test/scala/sigmastate/utxo/examples/IcoExample.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/IcoExample.scala index fa60cc20b9..251b9d1329 100644 --- a/sc/shared/src/test/scala/sigmastate/utxo/examples/IcoExample.scala +++ b/sc/shared/src/test/scala/sigmastate/utxo/examples/IcoExample.scala @@ -11,9 +11,10 @@ import scorex.crypto.hash.{Blake2b256, Digest32} import sigmastate.Values._ import sigmastate._ import sigmastate.basics.CryptoConstants +import sigmastate.eval.Extensions.ArrayOps import sigmastate.eval._ import sigmastate.helpers.TestingHelpers._ -import sigmastate.helpers.{ContextEnrichingTestProvingInterpreter, ErgoLikeContextTesting, ErgoLikeTestProvingInterpreter, CompilerTestingCommons} +import sigmastate.helpers.{CompilerTestingCommons, ContextEnrichingTestProvingInterpreter, ErgoLikeContextTesting, ErgoLikeTestProvingInterpreter} import sigmastate.interpreter.Interpreter.ScriptNameProp import sigmastate.interpreter.Interpreter import sigmastate.lang.Terms._ @@ -382,7 +383,7 @@ class IcoExample extends CompilerTestingCommons property("simple ico example - fundraising stage only") { val avlProver = new BatchAVLProver[Digest32, Blake2b256.type](keyLength = 32, None) - val digest = avlProver.digest + val digest = avlProver.digest.toColl val initTreeData = SigmaDsl.avlTree(new AvlTreeData(digest, AvlTreeFlags.AllOperationsAllowed, 32, None)) val fundingTree = mkTestErgoTree(fundingScript) @@ -406,7 +407,7 @@ class IcoExample extends CompilerTestingCommons } val proof = avlProver.generateProof() - val endTree = SigmaDsl.avlTree(new AvlTreeData(avlProver.digest, AvlTreeFlags.AllOperationsAllowed, 32, None)) + val endTree = SigmaDsl.avlTree(new AvlTreeData(avlProver.digest.toColl, AvlTreeFlags.AllOperationsAllowed, 32, None)) val projectBoxAfter = testBox(funderBoxCount * 10 - 1, fundingTree, 0, Seq(), Map(R4 -> ByteArrayConstant(Array.fill(1)(0: Byte)), R5 -> AvlTreeConstant(endTree))) @@ -435,14 +436,14 @@ class IcoExample extends CompilerTestingCommons property("simple ico example - issuance stage") { val avlProver = new BatchAVLProver[Digest32, Blake2b256.type](keyLength = 32, None) val digest = avlProver.digest - val openTreeData = SigmaDsl.avlTree(new AvlTreeData(digest, AvlTreeFlags.AllOperationsAllowed, 32, None)) + val openTreeData = SigmaDsl.avlTree(new AvlTreeData(digest.toColl, AvlTreeFlags.AllOperationsAllowed, 32, None)) val issuanceTree = mkTestErgoTree(issuanceScript) val projectBoxBeforeClosing = testBox(10, issuanceTree, 0, Seq(), Map(R4 -> ByteArrayConstant(Array.emptyByteArray), R5 -> AvlTreeConstant(openTreeData))) val tokenId = Digest32Coll @@@ Colls.fromArray(projectBoxBeforeClosing.id) - val closedTreeData = SigmaDsl.avlTree(new AvlTreeData(digest, AvlTreeFlags.RemoveOnly, 32, None)) + val closedTreeData = SigmaDsl.avlTree(new AvlTreeData(digest.toColl, AvlTreeFlags.RemoveOnly, 32, None)) val projectBoxAfterClosing = testBox(1, withdrawalTree, 0, Seq(tokenId -> projectBoxBeforeClosing.value), @@ -485,7 +486,7 @@ class IcoExample extends CompilerTestingCommons avlProver.performOneOperation(Insert(ADKey @@@ k, ADValue @@ v)) } val digest = avlProver.digest - val fundersTree = new AvlTreeData(digest, AvlTreeFlags.RemoveOnly, 32, None) + val fundersTree = new AvlTreeData(digest.toColl, AvlTreeFlags.RemoveOnly, 32, None) val withdrawalsCount = 8 val withdrawals = funderKvs.take(withdrawalsCount) @@ -502,7 +503,7 @@ class IcoExample extends CompilerTestingCommons } val removalProof = avlProver.generateProof() - val finalTree = new AvlTreeData(avlProver.digest, AvlTreeFlags.RemoveOnly, 32, None) + val finalTree = new AvlTreeData(avlProver.digest.toColl, AvlTreeFlags.RemoveOnly, 32, None) val tokenId = Digest32Coll @@ Colls.fromArray(Array.fill(32)(Random.nextInt(100).toByte)) diff --git a/sc/shared/src/test/scala/sigmastate/utxo/examples/LetsSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/LetsSpecification.scala index f2d409aaab..ef95e480f8 100644 --- a/sc/shared/src/test/scala/sigmastate/utxo/examples/LetsSpecification.scala +++ b/sc/shared/src/test/scala/sigmastate/utxo/examples/LetsSpecification.scala @@ -7,6 +7,7 @@ import scorex.crypto.authds.avltree.batch.{BatchAVLProver, Insert, Lookup} import scorex.crypto.hash.{Blake2b256, Digest32} import sigmastate.{AvlTreeData, AvlTreeFlags, CompilerCrossVersionProps, TrivialProp} import sigmastate.Values.{AvlTreeConstant, ByteArrayConstant, LongConstant, SigmaPropConstant} +import sigmastate.eval.Extensions.ArrayOps import sigmastate.eval.{Colls, Digest32Coll, IRContext, SigmaDsl} import sigmastate.helpers.{CompilerTestingCommons, ContextEnrichingTestProvingInterpreter, ErgoLikeContextTesting, ErgoLikeTestProvingInterpreter} import sigmastate.helpers.TestingHelpers._ @@ -282,7 +283,7 @@ class LetsSpecification extends CompilerTestingCommons with CompilerCrossVersion property("adding new member") { val avlProver = new BatchAVLProver[Digest32, Blake2b256.type](keyLength = 32, None) val digest = avlProver.digest - val initTreeData = new AvlTreeData(digest, AvlTreeFlags.InsertOnly, 32, None) + val initTreeData = new AvlTreeData(digest.toColl, AvlTreeFlags.InsertOnly, 32, None) val managementTree = mkTestErgoTree(managementScript) val projectBoxBefore = testBox(10, managementTree, 0, @@ -296,7 +297,7 @@ class LetsSpecification extends CompilerTestingCommons with CompilerCrossVersion avlProver.performOneOperation(Insert(ADKey @@@ userTokenId.toArray, ADValue @@ Array.emptyByteArray)) val proof = avlProver.generateProof() - val endTree = new AvlTreeData(avlProver.digest, AvlTreeFlags.InsertOnly, 32, None) + val endTree = new AvlTreeData(avlProver.digest.toColl, AvlTreeFlags.InsertOnly, 32, None) val projectBoxAfter = testBox(9, managementTree, 0, Seq(letsTokenId -> 1L), @@ -334,7 +335,7 @@ class LetsSpecification extends CompilerTestingCommons with CompilerCrossVersion avlProver.performOneOperation(Insert(ADKey @@@ userTokenId1.toArray, ADValue @@ Array.emptyByteArray)) val digest = avlProver.digest avlProver.generateProof() - val initTreeData = new AvlTreeData(digest, AvlTreeFlags.InsertOnly, 32, None) + val initTreeData = new AvlTreeData(digest.toColl, AvlTreeFlags.InsertOnly, 32, None) avlProver.performOneOperation(Lookup(ADKey @@@ userTokenId0.toArray)) avlProver.performOneOperation(Lookup(ADKey @@@ userTokenId1.toArray)) diff --git a/sc/shared/src/test/scala/sigmastate/utxo/examples/MASTExampleSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/MASTExampleSpecification.scala index f1fbfc3765..54d2ec0241 100644 --- a/sc/shared/src/test/scala/sigmastate/utxo/examples/MASTExampleSpecification.scala +++ b/sc/shared/src/test/scala/sigmastate/utxo/examples/MASTExampleSpecification.scala @@ -7,7 +7,8 @@ import scorex.crypto.hash.{Blake2b256, Digest32} import sigmastate.SCollection.SByteArray import sigmastate.Values._ import sigmastate._ -import sigmastate.helpers.{ContextEnrichingTestProvingInterpreter, ErgoLikeContextTesting, ErgoLikeTestInterpreter, CompilerTestingCommons} +import sigmastate.eval.Extensions.ArrayOps +import sigmastate.helpers.{CompilerTestingCommons, ContextEnrichingTestProvingInterpreter, ErgoLikeContextTesting, ErgoLikeTestInterpreter} import sigmastate.helpers.TestingHelpers._ import sigmastate.lang.Terms._ import sigmastate.interpreter.Interpreter._ @@ -28,7 +29,7 @@ import scala.util.Random */ class MASTExampleSpecification extends CompilerTestingCommons with CompilerCrossVersionProps { - implicit lazy val IR = new TestingIRContext + implicit lazy val IR: TestingIRContext = new TestingIRContext private val reg1 = ErgoBox.nonMandatoryRegisters.head /** @@ -90,7 +91,7 @@ class MASTExampleSpecification extends CompilerTestingCommons val avlProver = new BatchAVLProver[Digest32, Blake2b256.type](keyLength = 32, None) treeElements.foreach(s => avlProver.performOneOperation(Insert(s._1, s._2))) avlProver.generateProof() - val treeData = SigmaDsl.avlTree(new AvlTreeData(avlProver.digest, AvlTreeFlags.ReadOnly, 32, None)) + val treeData = SigmaDsl.avlTree(new AvlTreeData(avlProver.digest.toColl, AvlTreeFlags.ReadOnly, 32, None)) val merklePathToScript = OptionIsDefined( IR.builder.mkMethodCall( diff --git a/sc/shared/src/test/scala/sigmastate/utxo/examples/OracleExamplesSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/OracleExamplesSpecification.scala index aab0ac99e9..5dabe5114a 100644 --- a/sc/shared/src/test/scala/sigmastate/utxo/examples/OracleExamplesSpecification.scala +++ b/sc/shared/src/test/scala/sigmastate/utxo/examples/OracleExamplesSpecification.scala @@ -2,21 +2,22 @@ package sigmastate.utxo.examples import scorex.utils.Longs import org.ergoplatform.ErgoBox.RegisterId -import scorex.crypto.authds.avltree.batch.{BatchAVLProver, Lookup, Insert} -import scorex.crypto.authds.{ADValue, ADKey} +import scorex.crypto.authds.avltree.batch.{BatchAVLProver, Insert, Lookup} +import scorex.crypto.authds.{ADKey, ADValue} import scorex.crypto.hash.{Blake2b256, Digest32} import sigmastate.SCollection.SByteArray import sigmastate.Values._ import sigmastate._ import sigmastate.eval._ import sigmastate.lang.Terms._ -import sigmastate.helpers.{ErgoLikeTestInterpreter, ContextEnrichingTestProvingInterpreter, ErgoLikeContextTesting, CompilerTestingCommons} +import sigmastate.helpers.{CompilerTestingCommons, ContextEnrichingTestProvingInterpreter, ErgoLikeContextTesting, ErgoLikeTestInterpreter} import sigmastate.helpers.TestingHelpers._ import org.ergoplatform._ -import org.ergoplatform.dsl.{StdContracts, ContractSpec, TestContractSpec, SigmaContractSyntax} +import org.ergoplatform.dsl.{ContractSpec, SigmaContractSyntax, StdContracts, TestContractSpec} import sigmastate.basics.CryptoConstants import sigmastate.crypto.CryptoFacade -import sigmastate.interpreter.Interpreter.{emptyEnv, ScriptNameProp} +import sigmastate.eval.Extensions.ArrayOps +import sigmastate.interpreter.Interpreter.{ScriptNameProp, emptyEnv} import sigmastate.utxo._ import special.sigma.Context import sigmastate.utils.Helpers._ @@ -117,8 +118,7 @@ class OracleExamplesSpecification extends CompilerTestingCommons avlProver.generateProof() val lastBlockUtxoDigest = avlProver.digest - - val treeData = new AvlTreeData(lastBlockUtxoDigest, AvlTreeFlags.ReadOnly, 32, None) + val treeData = new AvlTreeData(lastBlockUtxoDigest.toColl, AvlTreeFlags.ReadOnly, 32, None) def extract[T <: SType](Rn: RegisterId)(implicit tT: T) = ExtractRegisterAs[T](GetVarBox(22: Byte).get, Rn)(tT).get diff --git a/sc/shared/src/test/scala/special/sigma/SigmaDslSpecification.scala b/sc/shared/src/test/scala/special/sigma/SigmaDslSpecification.scala index 18f5a980c5..07984e81f4 100644 --- a/sc/shared/src/test/scala/special/sigma/SigmaDslSpecification.scala +++ b/sc/shared/src/test/scala/special/sigma/SigmaDslSpecification.scala @@ -4416,9 +4416,7 @@ class SigmaDslSpecification extends SigmaDslTesting Seq( (box1, Expected(Success(CAvlTree( AvlTreeData( - ADDigest @@ ( - ErgoAlgos.decodeUnsafe("4ec61f485b98eb87153f7c57db4f5ecd75556fddbc403b41acf8441fde8e160900") - ), + ErgoAlgos.decodeUnsafe("4ec61f485b98eb87153f7c57db4f5ecd75556fddbc403b41acf8441fde8e160900").toColl, AvlTreeFlags(true, true, true), 32, None @@ -4678,7 +4676,7 @@ class SigmaDslSpecification extends SigmaDslTesting Helpers.decodeBytes("c1d70ad9b1ffc1fb9a715fff19807f2401017fcd8b73db017f1cff77727fff08"), CAvlTree( AvlTreeData( - ADDigest @@ (ErgoAlgos.decodeUnsafe("54d23dd080006bdb56800100356080935a80ffb77e90b800057f00661601807f17")), + ErgoAlgos.decodeUnsafe("54d23dd080006bdb56800100356080935a80ffb77e90b800057f00661601807f17").toColl, AvlTreeFlags(true, true, false), 2147483647, None @@ -4768,7 +4766,7 @@ class SigmaDslSpecification extends SigmaDslTesting selfIndex = 0, lastBlockUtxoRootHash = CAvlTree( AvlTreeData( - ADDigest @@ (ErgoAlgos.decodeUnsafe("54d23dd080006bdb56800100356080935a80ffb77e90b800057f00661601807f17")), + ErgoAlgos.decodeUnsafe("54d23dd080006bdb56800100356080935a80ffb77e90b800057f00661601807f17").toColl, AvlTreeFlags(true, true, true), 1211925457, None diff --git a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Isos.scala b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Isos.scala index b0ad838cf2..c00f72bdff 100644 --- a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Isos.scala +++ b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Isos.scala @@ -90,7 +90,7 @@ object Isos { override def to(x: AvlTree): sigma.AvlTree = { CAvlTree( AvlTreeData( - digest = ADDigest @@ isoStringToArray.to(x.digest), + digest = isoStringToArray.to(x.digest).toColl, treeFlags = AvlTreeFlags(x.insertAllowed, x.updateAllowed, x.removeAllowed), x.keyLength, valueLengthOpt = isoUndefOr(Iso.identityIso[Int]).to(x.valueLengthOpt), diff --git a/sdk/shared/src/main/scala/org/ergoplatform/sdk/AppkitProvingInterpreter.scala b/sdk/shared/src/main/scala/org/ergoplatform/sdk/AppkitProvingInterpreter.scala index d39187c48a..91e684d9ac 100644 --- a/sdk/shared/src/main/scala/org/ergoplatform/sdk/AppkitProvingInterpreter.scala +++ b/sdk/shared/src/main/scala/org/ergoplatform/sdk/AppkitProvingInterpreter.scala @@ -5,20 +5,18 @@ import org.ergoplatform._ import org.ergoplatform.sdk.Extensions.{CollOps, PairCollOps} import org.ergoplatform.sdk.JavaHelpers.{TokenColl, UniversalConverter} import org.ergoplatform.sdk.utils.ArithUtils -import org.ergoplatform.sdk.wallet.protocol.context.{ErgoLikeParameters, ErgoLikeStateContext} +import org.ergoplatform.sdk.wallet.protocol.context.{ErgoLikeParameters, ErgoLikeStateContext, TransactionContext} import org.ergoplatform.sdk.wallet.secrets.ExtendedSecretKey +import org.ergoplatform.validation.ValidationRules import scalan.util.Extensions.LongOps import sigmastate.Values.SigmaBoolean -import sigmastate.{AvlTreeData, VersionContext} import sigmastate.basics.DLogProtocol.{DLogProverInput, ProveDlog} import sigmastate.basics.{DiffieHellmanTupleProverInput, SigmaProtocolPrivateInput} import sigmastate.interpreter.Interpreter.{ReductionResult, estimateCryptoVerifyCost} -import sigmastate.interpreter.{ContextExtension, CostedProverResult, HintsBag, Interpreter, ProverInterpreter, ProverResult} +import sigmastate.interpreter._ import sigmastate.serialization.SigmaSerializer import sigmastate.utils.{SigmaByteReader, SigmaByteWriter} -import org.ergoplatform.sdk.wallet.protocol.context.TransactionContext -import org.ergoplatform.validation.ValidationRules -import scorex.crypto.authds.ADDigest +import sigmastate.{AvlTreeData, VersionContext} import java.util import java.util.{Objects, List => JList} @@ -186,7 +184,7 @@ class AppkitProvingInterpreter( require(util.Arrays.equals(unsignedInput.boxId, inputBox.box.id)) val context = new ErgoLikeContext( - AvlTreeData.avlTreeFromDigest(ADDigest @@ stateContext.previousStateDigest.toArray), + AvlTreeData.avlTreeFromDigest(stateContext.previousStateDigest), stateContext.sigmaLastHeaders, stateContext.sigmaPreHeader, transactionContext.dataBoxes, diff --git a/sdk/shared/src/main/scala/org/ergoplatform/sdk/JsonCodecs.scala b/sdk/shared/src/main/scala/org/ergoplatform/sdk/JsonCodecs.scala index 2c357a558f..42d25e09d4 100644 --- a/sdk/shared/src/main/scala/org/ergoplatform/sdk/JsonCodecs.scala +++ b/sdk/shared/src/main/scala/org/ergoplatform/sdk/JsonCodecs.scala @@ -278,7 +278,7 @@ trait JsonCodecs { treeFlagsByte <- cursor.downField("treeFlags").as[Byte] keyLength <- cursor.downField("keyLength").as[Int] valueLength <- cursor.downField("valueLength").as[Option[Int]] - } yield new AvlTreeData(digest, AvlTreeFlags(treeFlagsByte), keyLength, valueLength) + } yield new AvlTreeData(Colls.fromArray(digest), AvlTreeFlags(treeFlagsByte), keyLength, valueLength) }) implicit val ergoTreeEncoder: Encoder[ErgoTree] = Encoder.instance({ value => diff --git a/sdk/shared/src/main/scala/org/ergoplatform/sdk/ReducingInterpreter.scala b/sdk/shared/src/main/scala/org/ergoplatform/sdk/ReducingInterpreter.scala index a78c49e412..b7d8547e32 100644 --- a/sdk/shared/src/main/scala/org/ergoplatform/sdk/ReducingInterpreter.scala +++ b/sdk/shared/src/main/scala/org/ergoplatform/sdk/ReducingInterpreter.scala @@ -131,7 +131,7 @@ class ReducingInterpreter(params: ErgoLikeParameters) extends ErgoLikeInterprete require(util.Arrays.equals(unsignedInput.boxId, inputBox.box.id)) val context = new ErgoLikeContext( - AvlTreeData.avlTreeFromDigest(ADDigest @@ stateContext.previousStateDigest.toArray), + AvlTreeData.avlTreeFromDigest(stateContext.previousStateDigest), stateContext.sigmaLastHeaders, stateContext.sigmaPreHeader, transactionContext.dataBoxes, diff --git a/sdk/shared/src/main/scala/org/ergoplatform/sdk/SecretString.scala b/sdk/shared/src/main/scala/org/ergoplatform/sdk/SecretString.scala index 4c25ef6891..4cf8e8b2c3 100644 --- a/sdk/shared/src/main/scala/org/ergoplatform/sdk/SecretString.scala +++ b/sdk/shared/src/main/scala/org/ergoplatform/sdk/SecretString.scala @@ -83,7 +83,7 @@ final class SecretString private[sdk](val _data: Array[Char]) { if (obj == null) return false obj match { case anotherString: SecretString if _data.length == anotherString._data.length => - var n: Int = _data.length + val n: Int = _data.length val v1: Array[Char] = _data val v2: Array[Char] = anotherString._data cfor(0)(_ < n, _ + 1) { i => diff --git a/sdk/shared/src/main/scala/org/ergoplatform/sdk/utils/Zero.scala b/sdk/shared/src/main/scala/org/ergoplatform/sdk/utils/Zero.scala index e899319231..2115d774a0 100644 --- a/sdk/shared/src/main/scala/org/ergoplatform/sdk/utils/Zero.scala +++ b/sdk/shared/src/main/scala/org/ergoplatform/sdk/utils/Zero.scala @@ -2,22 +2,19 @@ package org.ergoplatform.sdk.utils import org.ergoplatform.ErgoBox import scalan.RType -import scalan.RType.{BooleanType, ByteType, FuncType, IntType, LongType, OptionType, PairType, ShortType, UnitType} +import scalan.RType._ import scorex.crypto.authds.avltree.batch.BatchAVLProver import scorex.crypto.hash.{Blake2b256, Digest32} import scorex.util.ModifierId -import sigmastate.{AvlTreeData, AvlTreeFlags, TrivialProp} import sigmastate.Values.ErgoTree import sigmastate.basics.CryptoConstants -import sigmastate.eval.{CAvlTree, CBigInt, CGroupElement, CHeader, CPreHeader, CSigmaProp, Colls, CostingBox, CostingDataContext} +import sigmastate.eval._ +import sigmastate.{AvlTreeData, AvlTreeFlags, TrivialProp} import special.Types.TupleType import special.collection.{Coll, CollType} -import special.sigma.{AvlTree, AvlTreeRType, BigInt, BigIntRType, Box, BoxRType, Context, ContextRType, GroupElement, GroupElementRType, Header, HeaderRType, PreHeader, PreHeaderRType, SigmaDslBuilder, SigmaDslBuilderRType, SigmaProp, SigmaPropRType} +import special.sigma.{AvlTree, AvlTreeRType, BigInt, BigIntRType, Box, BoxRType, GroupElement, GroupElementRType, SigmaProp, SigmaPropRType} import java.math.BigInteger -import scalan.RType._ -import sigmastate.eval._ -import special.sigma._ import scala.language.implicitConversions /** @@ -58,7 +55,7 @@ object Zero extends ZeroLowPriority { implicit val AvlTreeIsZero: Zero[AvlTree] = CZero({ val avlProver = new BatchAVLProver[Digest32, Blake2b256.type](keyLength = 32, None) val digest = avlProver.digest - val treeData = new AvlTreeData(digest, AvlTreeFlags.AllOperationsAllowed, 32, None) + val treeData = new AvlTreeData(Colls.fromArray(digest), AvlTreeFlags.AllOperationsAllowed, 32, None) CAvlTree(treeData) }) implicit val sigmaPropIsZero: Zero[SigmaProp] = CZero(CSigmaProp(TrivialProp.FalseProp)) From 7550d6b0347a19fc502c65ae43b2e7dbc8d0c268 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Tue, 18 Jul 2023 20:12:13 +0200 Subject: [PATCH 52/58] v5.0.10-RC: fix test --- sc/jvm/src/test/scala/sigmastate/helpers/SigmaPPrintSpec.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sc/jvm/src/test/scala/sigmastate/helpers/SigmaPPrintSpec.scala b/sc/jvm/src/test/scala/sigmastate/helpers/SigmaPPrintSpec.scala index bb41b44418..59e08c918f 100644 --- a/sc/jvm/src/test/scala/sigmastate/helpers/SigmaPPrintSpec.scala +++ b/sc/jvm/src/test/scala/sigmastate/helpers/SigmaPPrintSpec.scala @@ -81,7 +81,7 @@ class SigmaPPrintSpec extends SigmaDslTesting { test(t1, """AvlTreeData( | ADDigest @@ ( - | ErgoAlgos.decodeUnsafe("000183807f66b301530120ff7fc6bd6601ff01ff7f7d2bedbbffff00187fe89094") + | Helpers.decodeBytes("000183807f66b301530120ff7fc6bd6601ff01ff7f7d2bedbbffff00187fe89094") | ), | AvlTreeFlags(false, true, true), | 1, From 4d96fdc0ea1c9fd3932b881eda3bd33c8a3dc6ad Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Wed, 26 Jul 2023 18:19:16 +0200 Subject: [PATCH 53/58] tree-template: implemented fromHex, templateHex --- .../src/main/scala/sigmastate/Values.scala | 27 +++++++++++++++++-- .../sigmastate/ErgoTreeSpecification.scala | 19 ++++++++----- .../org/ergoplatform/sdk/js/ErgoTree.scala | 17 +++++++----- sigma-js/tests/js/ErgoTree.spec.js | 6 +++++ 4 files changed, 55 insertions(+), 14 deletions(-) diff --git a/interpreter/shared/src/main/scala/sigmastate/Values.scala b/interpreter/shared/src/main/scala/sigmastate/Values.scala index c2b6de9823..1e9114a782 100644 --- a/interpreter/shared/src/main/scala/sigmastate/Values.scala +++ b/interpreter/shared/src/main/scala/sigmastate/Values.scala @@ -15,7 +15,7 @@ import sigmastate.serialization.OpCodes._ import sigmastate.TrivialProp.{FalseProp, TrueProp} import sigmastate.Values.ErgoTree.substConstants import sigmastate.basics.DLogProtocol.ProveDlog -import sigmastate.basics.{ProveDHTuple, CryptoConstants} +import sigmastate.basics.{CryptoConstants, ProveDHTuple} import sigmastate.lang.Terms._ import sigmastate.utxo._ import sigmastate.eval._ @@ -23,7 +23,9 @@ import sigmastate.eval.Extensions._ import scalan.util.Extensions.ByteOps import sigmastate.interpreter.ErgoTreeEvaluator._ import debox.cfor +import scorex.util.encode.Base16 import sigmastate.exceptions.InterpreterException + import scala.language.implicitConversions import scala.reflect.ClassTag import sigmastate.lang.CheckingSigmaBuilder._ @@ -1314,13 +1316,16 @@ object Values { } /** Serialized proposition expression of SigmaProp type with - * ConstantPlaceholder nodes instead of Constant nodes + * ConstantPlaceholder nodes not replaced by Constant nodes. */ lazy val template: Array[Byte] = { val r = SigmaSerializer.startReader(bytes) DefaultSerializer.deserializeHeaderWithTreeBytes(r)._4 } + /** Base16 encoding of `template` bytes. */ + def templateHex: String = Base16.encode(template) + /** Get proposition expression from this contract. * When root.isRight then * if replaceConstants == false this is the same as `root.right.get`. @@ -1496,6 +1501,24 @@ object Values { */ def withSegregation(prop: SigmaPropValue): ErgoTree = withSegregation(DefaultHeader, prop) + + /** Deserializes an ErgoTree instance from a hexadecimal string. + * + * @param hex a hexadecimal string representing the serialized ErgoTree + */ + def fromHex(hex: String): ErgoTree = { + val bytes = Base16.decode(hex).get + fromBytes(bytes) + } + + /** Deserializes an ErgoTree instance from an array of bytes. + * + * @param bytes an array of bytes representing the serialized ErgoTree + */ + def fromBytes(bytes: Array[Byte]): ErgoTree = { + ErgoTreeSerializer.DefaultSerializer.deserializeErgoTree(bytes) + } + } } diff --git a/sc/shared/src/test/scala/sigmastate/ErgoTreeSpecification.scala b/sc/shared/src/test/scala/sigmastate/ErgoTreeSpecification.scala index d76f54e6e8..20aabb1b00 100644 --- a/sc/shared/src/test/scala/sigmastate/ErgoTreeSpecification.scala +++ b/sc/shared/src/test/scala/sigmastate/ErgoTreeSpecification.scala @@ -75,12 +75,19 @@ class ErgoTreeSpecification extends SigmaDslTesting with ContractsTestkit { } property("ErgoTree.template") { - val t = new ErgoTree( - 16.toByte, - Array(IntConstant(1)), - Right(BoolToSigmaProp(EQ(ConstantPlaceholder(0, SInt), IntConstant(1)))) - ) - t.template shouldBe ErgoAlgos.decodeUnsafe("d19373000402") + { + val t = new ErgoTree( + 16.toByte, + Array(IntConstant(1)), + Right(BoolToSigmaProp(EQ(ConstantPlaceholder(0, SInt), IntConstant(1)))) + ) + t.template shouldBe ErgoAlgos.decodeUnsafe("d19373000402") + } + + { + val t = ErgoTree.fromHex("100604000e000400040005000500d803d601e30004d602e4c6a70408d603e4c6a7050595e67201d804d604b2a5e4720100d605b2db63087204730000d606db6308a7d60799c1a7c17204d1968302019683050193c27204c2a7938c720501730193e4c672040408720293e4c672040505720393e4c67204060ec5a796830201929c998c7205029591b1720673028cb272067303000273047203720792720773057202") + t.templateHex shouldBe "d803d601e30004d602e4c6a70408d603e4c6a7050595e67201d804d604b2a5e4720100d605b2db63087204730000d606db6308a7d60799c1a7c17204d1968302019683050193c27204c2a7938c720501730193e4c672040408720293e4c672040505720393e4c67204060ec5a796830201929c998c7205029591b1720673028cb272067303000273047203720792720773057202" + } } property("ErgoTree.bytes") { diff --git a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/ErgoTree.scala b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/ErgoTree.scala index 672f79e687..810cc1ea81 100644 --- a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/ErgoTree.scala +++ b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/ErgoTree.scala @@ -26,6 +26,14 @@ class ErgoTree(tree: Values.ErgoTree) extends js.Object { /** Serializes the ErgoTree instance to a hexadecimal string. */ def toHex(): String = tree.bytesHex + /** Serialized proposition expression of SigmaProp type with + * ConstantPlaceholder nodes not replaced by Constant nodes. + */ + def template(): Array[Byte] = tree.template + + /** Base16 encoding of `template` bytes. */ + def templateHex(): String = tree.templateHex + /** Returns segregated constants of this tree as [[js.Array]]. */ def constants(): js.Array[Value] = { val constants = tree.constants @@ -42,17 +50,14 @@ object ErgoTree extends js.Object { * * @param hex a hexadecimal string representing the serialized ErgoTree */ - def fromHex(hex: String): ErgoTree = { - val bytes = Base16.decode(hex).get - fromBytes(bytes) - } + def fromHex(hex: String): ErgoTree = + new ErgoTree(Values.ErgoTree.fromHex(hex)) /** Deserializes an ErgoTree instance from an array of bytes. * * @param bytes an array of bytes representing the serialized ErgoTree */ def fromBytes(bytes: Array[Byte]): ErgoTree = { - val tree = ErgoTreeSerializer.DefaultSerializer.deserializeErgoTree(bytes) - new ErgoTree(tree) + new ErgoTree(Values.ErgoTree.fromBytes(bytes)) } } diff --git a/sigma-js/tests/js/ErgoTree.spec.js b/sigma-js/tests/js/ErgoTree.spec.js index f951b2ea99..688ea9bfa3 100644 --- a/sigma-js/tests/js/ErgoTree.spec.js +++ b/sigma-js/tests/js/ErgoTree.spec.js @@ -29,5 +29,11 @@ describe("Smoke tests for ErgoTree", () => { let constants = tree.constants().map(c => c.toHex()) expect(constants).toEqual(["0400", "0e00", "0400", "0400", "0500", "0500"]) }); + + it("Has template", () => { + let tree = ErgoTreeObj.fromHex(hex); + let templateHex = tree.templateHex(); + expect(templateHex).toEqual("d803d601e30004d602e4c6a70408d603e4c6a7050595e67201d804d604b2a5e4720100d605b2db63087204730000d606db6308a7d60799c1a7c17204d1968302019683050193c27204c2a7938c720501730193e4c672040408720293e4c672040505720393e4c67204060ec5a796830201929c998c7205029591b1720673028cb272067303000273047203720792720773057202") + }); }); From ae2d144005683454edea8dbed58e10ebdcc9cf39 Mon Sep 17 00:00:00 2001 From: "Alison Robson (anon_br)" Date: Wed, 26 Jul 2023 17:00:17 -0300 Subject: [PATCH 54/58] Tree template types (#895) * add ErgoTree `template` and `templateHex` method and fix type exporting * Simplify package installing instructions --- sigma-js/README.md | 17 ++++++----------- sigma-js/package.json | 7 ++++--- sigma-js/sigmastate-js.d.ts | 21 ++++++++++++--------- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/sigma-js/README.md b/sigma-js/README.md index 22975e60cd..1531088cbd 100644 --- a/sigma-js/README.md +++ b/sigma-js/README.md @@ -15,26 +15,22 @@ The modules published here can be used directly from JavaScript. # Getting Started -Add the following dependency to your `package.json`: - -```json -{ - "dependencies": { - "sigmastate-js": "0.1.1" - } -} +Run following command to add Sigma.JS as a project dependency: + +```bash +npm install sigmastate-js ``` -Then run `npm install`. # Examples ### How to create Sigma type descriptors Import `TypeObj` module, then use: + - fields to create simple types (e.g. `TypeObj.Int`) - method `TypeObj.pairType` (e.g. `TypeObj.pairType(TypeObj.Int, TypeObj.Long)`) - method `TypeObj.collType` (e.g. `TypeObj.collType(TypeObj.Int)`) - + See examples in tests [Type.spec.js](https://github.com/ScorexFoundation/sigmastate-interpreter/blob/933acd7a3753725c8b41994c2126a20279b6809b/sigma-js/tests/js/Type.spec.js) ### How to create Sigma values @@ -51,4 +47,3 @@ See examples in tests [ErgoTree.spec.js](https://github.com/ScorexFoundation/sig Import `SigmaCompilerObj` module and `SigmaCompiler` class, then use its methods. See compiler tests in [SigmaCompiler.spec.js](https://github.com/ScorexFoundation/sigmastate-interpreter/blob/933acd7a3753725c8b41994c2126a20279b6809b/sigma-js/tests/js/SigmaCompiler.spec.js) - diff --git a/sigma-js/package.json b/sigma-js/package.json index 1e65230766..b1ff6c4df7 100644 --- a/sigma-js/package.json +++ b/sigma-js/package.json @@ -2,16 +2,17 @@ "name": "sigmastate-js", "version": "0.2.1", "description": "Sigma.js library", - "main": "dist/main.js", "files": [ "dist/", "sigmastate-js.d.ts", "README.md" ], - "types": "./sigmastate-js.d.ts", "exports": { "./internal-*": null, - "./*": "./dist/*.js" + "./main": { + "types": "./sigmastate-js.d.ts", + "default": "./dist/main.js" + } }, "license": "MIT", "publishConfig": { diff --git a/sigma-js/sigmastate-js.d.ts b/sigma-js/sigmastate-js.d.ts index 9351297677..04bc1c7f49 100644 --- a/sigma-js/sigmastate-js.d.ts +++ b/sigma-js/sigmastate-js.d.ts @@ -1,28 +1,31 @@ declare module "sigmastate-js/main" { type SigmaCompilerNamedConstantsMap = { [key: string]: Value }; type HexString = string; + type ByteArray = { u: Int8Array }; - class ErgoTree { + export declare class ErgoTree { toHex(): HexString; - bytes(): { u: Uint8Array }; + bytes(): ByteArray; header(): number; version(): number; isConstantSegregation(): boolean; hasSize(): boolean; constants(): Value[]; + template(): ByteArray; + templateHex(): HexString; toString(): string; } - class ErgoTreeObj { + export declare class ErgoTreeObj { static fromHex(value: HexString): ErgoTree; } - class Type { + export declare class Type { name: string; toString(): string; } - class TypeObj { + export declare class TypeObj { static Byte: Type; static Short: Type; static Int: Type; @@ -40,13 +43,13 @@ declare module "sigmastate-js/main" { static collType(elemType: Type): Type; } - class Value { + export declare class Value { data: T; tpe: Type; toHex(): HexString; } - class ValueObj { + export declare class ValueObj { static ofByte(value: number): Value; static ofShort(value: number): Value; static ofInt(value: number): Value; @@ -57,7 +60,7 @@ declare module "sigmastate-js/main" { static fromHex(hex: HexString): Value; } - class SigmaCompiler { + export declare class SigmaCompiler { compile( namedConstants: SigmaCompilerNamedConstantsMap, segregateConstants: boolean, @@ -66,7 +69,7 @@ declare module "sigmastate-js/main" { ): ErgoTree; } - class SigmaCompilerObj { + export declare class SigmaCompilerObj { static forMainnet(): SigmaCompiler; static forTestnet(): SigmaCompiler; } From b4a65a184556e43d2fe2273f8c53e505b074bc0b Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Tue, 1 Aug 2023 21:07:15 +0200 Subject: [PATCH 55/58] secure-random-js: upgrade sigmajsCryptoFacadeVersion = "0.0.7" and implement SecureRandom for js Platform --- build.sbt | 2 +- .../scala/sigmastate/crypto/Platform.scala | 4 ++-- .../crypto/SigmaJsCryptoFacade.scala | 20 +++++++++++++++++++ .../OracleExamplesSpecification.scala | 4 ++-- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/build.sbt b/build.sbt index 7053fd6555..371536017e 100644 --- a/build.sbt +++ b/build.sbt @@ -186,7 +186,7 @@ lazy val commonDependenies2 = libraryDependencies ++= Seq( "org.scala-lang.modules" %%% "scala-collection-compat" % "2.7.0" ) -val sigmajsCryptoFacadeVersion = "0.0.6" +val sigmajsCryptoFacadeVersion = "0.0.7" lazy val common = crossProject(JVMPlatform, JSPlatform) .in(file("common")) diff --git a/interpreter/js/src/main/scala/sigmastate/crypto/Platform.scala b/interpreter/js/src/main/scala/sigmastate/crypto/Platform.scala index 780b74f9a0..1b963331f2 100644 --- a/interpreter/js/src/main/scala/sigmastate/crypto/Platform.scala +++ b/interpreter/js/src/main/scala/sigmastate/crypto/Platform.scala @@ -120,7 +120,7 @@ object Platform { class Curve // TODO JS: Use JS library for secure source of randomness - type SecureRandom = Random + type SecureRandom = sigmastate.crypto.SecureRandomJS /** Opaque point type. */ @js.native @@ -198,7 +198,7 @@ object Platform { } /** Create JS specific source of secure randomness. */ - def createSecureRandom(): Random = new Random() + def createSecureRandom(): SecureRandom = new SecureRandomJS /** Computes HMAC-SHA512 hash of the given data using the specified key. * diff --git a/interpreter/js/src/main/scala/sigmastate/crypto/SigmaJsCryptoFacade.scala b/interpreter/js/src/main/scala/sigmastate/crypto/SigmaJsCryptoFacade.scala index 3b19095b6a..908d6ee166 100644 --- a/interpreter/js/src/main/scala/sigmastate/crypto/SigmaJsCryptoFacade.scala +++ b/interpreter/js/src/main/scala/sigmastate/crypto/SigmaJsCryptoFacade.scala @@ -1,5 +1,7 @@ package sigmastate.crypto +import debox.cfor + import scala.scalajs.js import scala.scalajs.js.annotation.JSImport import scala.scalajs.js.typedarray.Uint8Array @@ -109,6 +111,24 @@ object CryptoFacadeJs extends js.Object { def generatePbkdf2Key( normalizedMnemonic: String, normalizedPass: String): Uint8Array = js.native + + /** Creates a random array of bytes of the given length. */ + def getRandomBytes(length: Int): Uint8Array = js.native +} + +class SecureRandomJS { + /** + * Generates a user-specified number of random bytes. + * + * @param bytes the array to be filled in with random bytes. + */ + def nextBytes(bytes: Array[Byte]): Unit = { + val len = bytes.length + val arr = CryptoFacadeJs.getRandomBytes(len) + cfor(0)(_ < len, _ + 1) { i => + bytes(i) = arr(i).toByte + } + } } /** Represents imported Point class from `sigmajs-crypto-facade` JS libarary. */ diff --git a/sc/shared/src/test/scala/sigmastate/utxo/examples/OracleExamplesSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/OracleExamplesSpecification.scala index 5dabe5114a..1e7d4b45b6 100644 --- a/sc/shared/src/test/scala/sigmastate/utxo/examples/OracleExamplesSpecification.scala +++ b/sc/shared/src/test/scala/sigmastate/utxo/examples/OracleExamplesSpecification.scala @@ -15,7 +15,7 @@ import sigmastate.helpers.TestingHelpers._ import org.ergoplatform._ import org.ergoplatform.dsl.{ContractSpec, SigmaContractSyntax, StdContracts, TestContractSpec} import sigmastate.basics.CryptoConstants -import sigmastate.crypto.CryptoFacade +import sigmastate.crypto.{BigIntegers, CryptoFacade} import sigmastate.eval.Extensions.ArrayOps import sigmastate.interpreter.Interpreter.{ScriptNameProp, emptyEnv} import sigmastate.utxo._ @@ -89,7 +89,7 @@ class OracleExamplesSpecification extends CompilerTestingCommons val temperature: Long = 18 - val r = BigInt.apply(128, CryptoFacade.createSecureRandom()) //128 bits random number + val r = BigInt(BigIntegers.createRandomBigInteger(128, CryptoFacade.createSecureRandom())) //128 bits random number val a = group.exponentiate(group.generator, r.bigInteger) val ts = System.currentTimeMillis() From 5b3581308354175f936bb5163d22bfce7d6056e7 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Fri, 4 Aug 2023 11:58:48 +0200 Subject: [PATCH 56/58] secure-random-js: add ScalaDoc --- .../src/main/scala/sigmastate/crypto/SigmaJsCryptoFacade.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/interpreter/js/src/main/scala/sigmastate/crypto/SigmaJsCryptoFacade.scala b/interpreter/js/src/main/scala/sigmastate/crypto/SigmaJsCryptoFacade.scala index 908d6ee166..fa60015ed2 100644 --- a/interpreter/js/src/main/scala/sigmastate/crypto/SigmaJsCryptoFacade.scala +++ b/interpreter/js/src/main/scala/sigmastate/crypto/SigmaJsCryptoFacade.scala @@ -116,6 +116,7 @@ object CryptoFacadeJs extends js.Object { def getRandomBytes(length: Int): Uint8Array = js.native } +/** This class provides a cryptographically strong generator of byte arrays. */ class SecureRandomJS { /** * Generates a user-specified number of random bytes. From acffbef68edfca6517bd8fb91f41dc864c750086 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Fri, 4 Aug 2023 14:51:20 +0200 Subject: [PATCH 57/58] secure-random-js: fixed js Platform.exponentiatePoint --- .../src/main/scala/sigmastate/crypto/Platform.scala | 13 +++++++++++-- .../utxo/examples/OracleExamplesSpecification.scala | 3 ++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/interpreter/js/src/main/scala/sigmastate/crypto/Platform.scala b/interpreter/js/src/main/scala/sigmastate/crypto/Platform.scala index 1b963331f2..d23407e7d7 100644 --- a/interpreter/js/src/main/scala/sigmastate/crypto/Platform.scala +++ b/interpreter/js/src/main/scala/sigmastate/crypto/Platform.scala @@ -100,14 +100,23 @@ object Platform { def multiplyPoints(p1: Ecp, p2: Ecp): Ecp = new Ecp(CryptoFacadeJs.addPoint(p1.point, p2.point)) /** Exponentiate a point p. + * The implementation mimics the Java implementation of `AbstractECMultiplier.multiply` + * from BouncyCastle library. * * @param p point to exponentiate * @param n exponent * @return p to the power of n (`p^n`) i.e. `p + p + ... + p` (n times) */ def exponentiatePoint(p: Ecp, n: BigInteger): Ecp = { - val scalar = Convert.bigIntegerToBigInt(n) - new Ecp(CryptoFacadeJs.multiplyPoint(p.point, scalar)) + val sign = n.signum() + if (sign == 0 || isInfinityPoint(p)) { + val ctx = new CryptoContextJs() + return new Ecp(ctx.getInfinity()) + } + val scalar = Convert.bigIntegerToBigInt(n.abs()) + val positive = CryptoFacadeJs.multiplyPoint(p.point, scalar) + val result = if (sign > 0) positive else CryptoFacadeJs.negatePoint(positive) + new Ecp(result) } /** Check if a point is infinity. */ diff --git a/sc/shared/src/test/scala/sigmastate/utxo/examples/OracleExamplesSpecification.scala b/sc/shared/src/test/scala/sigmastate/utxo/examples/OracleExamplesSpecification.scala index 1e7d4b45b6..384f0d4b63 100644 --- a/sc/shared/src/test/scala/sigmastate/utxo/examples/OracleExamplesSpecification.scala +++ b/sc/shared/src/test/scala/sigmastate/utxo/examples/OracleExamplesSpecification.scala @@ -89,7 +89,8 @@ class OracleExamplesSpecification extends CompilerTestingCommons val temperature: Long = 18 - val r = BigInt(BigIntegers.createRandomBigInteger(128, CryptoFacade.createSecureRandom())) //128 bits random number + //create 128 bits random number + val r = BigInt(BigIntegers.createRandomBigInteger(128, CryptoFacade.createSecureRandom())) val a = group.exponentiate(group.generator, r.bigInteger) val ts = System.currentTimeMillis() From 95950700b3dbedb687b5c4e2ed3104973043e9b9 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Fri, 4 Aug 2023 14:56:18 +0200 Subject: [PATCH 58/58] secure-random-js: ci.yml: run scJS/test --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5398146f45..db3427969c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,7 +103,7 @@ jobs: key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} - name: Runs tests and collect coverage - run: sbt -jvm-opts ci/ci.jvmopts ++${{ matrix.scala }} commonJS/test corelibJS/test interpreterJS/test graphirJS/test sdkJS/test + run: sbt -jvm-opts ci/ci.jvmopts ++${{ matrix.scala }} commonJS/test corelibJS/test interpreterJS/test graphirJS/test sdkJS/test scJS/test - name: Publish a JVM snapshot ${{ github.ref }} if: env.HAS_SECRETS == 'true'