Skip to content

Commit

Permalink
Merge pull request #522 from ScorexFoundation/v2.1.2
Browse files Browse the repository at this point in the history
v2.1.2
  • Loading branch information
aslesarenko authored Jun 12, 2019
2 parents 6baf579 + cb095c7 commit 4751421
Show file tree
Hide file tree
Showing 19 changed files with 669 additions and 658 deletions.
9 changes: 6 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,9 @@ lazy val sigma = (project in file("."))
.settings(commonSettings: _*)

def runErgoTask(task: String, sigmastateVersion: String, log: Logger): Unit = {
val ergoBranch = "sigma-validation-settings"
val ergoBranch = "master"
val sbtEnvVars = Seq("BUILD_ENV" -> "test", "SIGMASTATE_VERSION" -> sigmastateVersion)

log.info(s"Testing current build in Ergo (branch $ergoBranch):")
val cwd = new File("").absolutePath
val ergoPath = new File(cwd + "/ergo-tests/")
Expand All @@ -211,14 +213,15 @@ def runErgoTask(task: String, sigmastateVersion: String, log: Logger): Unit = {
log.info(s"Cloning Ergo branch $ergoBranch into ${ergoPath.absolutePath}")
s"git clone -b $ergoBranch --single-branch https://github.com/ergoplatform/ergo.git ${ergoPath.absolutePath}" !


log.info(s"Updating Ergo in $ergoPath with Sigmastate version $sigmastateVersion")
Process(Seq("sbt", "unlock", "reload", "lock"), ergoPath, "SIGMASTATE_VERSION" -> sigmastateVersion) !
Process(Seq("sbt", "unlock", "reload", "lock"), ergoPath, sbtEnvVars: _*) !

log.info("Updated Ergo lock.sbt:")
Process(Seq("git", "diff", "-U0", "lock.sbt"), ergoPath) !

log.info(s"Running Ergo tests in $ergoPath with Sigmastate version $sigmastateVersion")
val res = Process(Seq("sbt", task), ergoPath, "SIGMASTATE_VERSION" -> sigmastateVersion) !
val res = Process(Seq("sbt", task), ergoPath, sbtEnvVars: _*) !

if (res != 0) sys.error(s"Ergo $task failed!")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import sigmastate.basics.DLogProtocol
import sigmastate.basics.DLogProtocol.DLogProverInput
import sigmastate.serialization.ErgoTreeSerializer.DefaultSerializer
import sigmastate.serialization.ValueSerializer
import sigmastate.serialization.generators.ValueGenerators
import sigmastate.serialization.generators.ObjectGenerators
import org.ergoplatform.ErgoScriptPredef._
import org.ergoplatform.validation.ValidationSpecification
import sigmastate.Values.ErgoTree

class ErgoAddressSpecification extends PropSpec
with ValueGenerators
with ObjectGenerators
with PropertyChecks
with Matchers
with TryValues
Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/org/ergoplatform/ErgoLikeTransactionSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import sigmastate.Values.ByteArrayConstant
import sigmastate.helpers.SigmaTestingCommons
import sigmastate.interpreter.{ContextExtension, ProverResult}
import sigmastate.serialization.SigmaSerializer
import sigmastate.serialization.generators.ValueGenerators
import sigmastate.serialization.generators.ObjectGenerators
import sigmastate.eval._
import sigmastate.eval.Extensions._
import sigmastate.SType._

class ErgoLikeTransactionSpec extends PropSpec
with GeneratorDrivenPropertyChecks
with Matchers
with ValueGenerators
with ObjectGenerators
with SigmaTestingCommons {

property("ErgoLikeTransaction: Serializer round trip") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import sigmastate.basics.DLogProtocol.{ProveDlog, DLogProverInput}
import scorex.crypto.hash.Blake2b256
import sigmastate.Values._
import sigmastate.interpreter._
import sigma.util.Extensions._
import Interpreter._
import sigmastate.lang.Terms._
import org.ergoplatform._
Expand All @@ -28,7 +29,8 @@ class TestingInterpreterSpecification extends SigmaTestingCommons {
fakeSelf)

property("Reduction to crypto #1") {
forAll() { (h: Int) =>
forAll() { i: Int =>
val h = i.toAbs
whenever(h > 0 && h < Int.MaxValue - 1) {
val dk1 = SigmaPropConstant(DLogProverInput.random().publicImage).isProven

Expand Down Expand Up @@ -61,8 +63,8 @@ class TestingInterpreterSpecification extends SigmaTestingCommons {
}

property("Reduction to crypto #2") {
forAll() { (h: Int) =>

forAll() { i: Int =>
val h = i.toAbs
whenever(h > 0 && h < Int.MaxValue - 1) {

val dk1 = DLogProverInput.random().publicImage.isProven
Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/sigmastate/lang/SigmaCompilerTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import sigmastate.interpreter.Interpreter.ScriptEnv
import sigmastate.lang.Terms.{Lambda, MethodCall, ZKProofBlock, Apply, Ident}
import sigmastate.lang.exceptions.{CosterException, InvalidArguments, TyperException}
import sigmastate.serialization.ValueSerializer
import sigmastate.serialization.generators.ValueGenerators
import sigmastate.serialization.generators.ObjectGenerators
import sigmastate.utxo.{GetVar, ExtractAmount, ByIndex, SelectField}
import sigmastate.eval._

class SigmaCompilerTest extends SigmaTestingCommons with LangTests with ValueGenerators {
class SigmaCompilerTest extends SigmaTestingCommons with LangTests with ObjectGenerators {
import CheckingSigmaBuilder._
implicit lazy val IR: TestingIRContext = new TestingIRContext {
beginPass(noConstPropagationPass)
Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/sigmastate/lang/SigmaSpecializerTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import sigmastate._
import sigmastate.lang.SigmaPredef.PredefinedFuncRegistry
import sigmastate.lang.Terms.{Ident, ZKProofBlock}
import sigmastate.lang.exceptions.SpecializerException
import sigmastate.serialization.generators.{ConcreteCollectionGenerators, TransformerGenerators, ValueGenerators}
import sigmastate.serialization.generators.{ConcreteCollectionGenerators, TransformerGenerators, ObjectGenerators}
import sigmastate.utxo._
import sigmastate.lang.Terms._

class SigmaSpecializerTest extends PropSpec
with PropertyChecks
with Matchers
with LangTests
with ValueGenerators
with ObjectGenerators
with ConcreteCollectionGenerators
with TransformerGenerators {

Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/sigmastate/lang/SigmaTyperTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import sigmastate.interpreter.Interpreter.ScriptEnv
import sigmastate.lang.SigmaPredef._
import sigmastate.lang.Terms.Select
import sigmastate.lang.exceptions.TyperException
import sigmastate.serialization.generators.ValueGenerators
import sigmastate.serialization.generators.ObjectGenerators
import sigmastate.utxo.{ExtractCreationInfo, Append}

class SigmaTyperTest extends PropSpec with PropertyChecks with Matchers with LangTests with ValueGenerators {
class SigmaTyperTest extends PropSpec with PropertyChecks with Matchers with LangTests with ObjectGenerators {

private val predefFuncRegistry = new PredefinedFuncRegistry(StdSigmaBuilder)
import predefFuncRegistry._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ trait SerializationSpecification extends PropSpec
with GeneratorDrivenPropertyChecks
with TableDrivenPropertyChecks
with Matchers
with ValueGenerators
with ObjectGenerators
with ConcreteCollectionGenerators
with OpcodesGen
with TransformerGenerators
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import sigmastate._
import sigmastate.basics.DLogProtocol.ProveDlog
import sigmastate.basics.ProveDHTuple
import sigmastate.helpers.{ContextEnrichingTestProvingInterpreter, SigmaTestingCommons}
import sigmastate.serialization.generators.ValueGenerators
import sigmastate.serialization.generators.ObjectGenerators
import sigmastate.utxo.Transformer

import scala.util.Random

class SigSerializerSpecification extends SigmaTestingCommons with ValueGenerators {
class SigSerializerSpecification extends SigmaTestingCommons with ObjectGenerators {
implicit lazy val IR = new TestingIRContext
private lazy implicit val arbExprGen: Arbitrary[SigmaBoolean] = Arbitrary(exprTreeGen)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.scalacheck.{Arbitrary, Gen}
import sigmastate._
import sigmastate.Values.{ConcreteCollection, EvaluatedValue, Value}

trait ConcreteCollectionGenerators { self: ValueGenerators =>
trait ConcreteCollectionGenerators { self: ObjectGenerators =>
val minCollLength = 1
val maxCollLength = 10

Expand Down
Loading

0 comments on commit 4751421

Please sign in to comment.