Skip to content

Commit

Permalink
Merge pull request #901 from ScorexFoundation/v5.0.11-RC
Browse files Browse the repository at this point in the history
Release Candidate v5.0.11
  • Loading branch information
aslesarenko authored Sep 5, 2023
2 parents 5d03858 + aa41958 commit 75f301a
Show file tree
Hide file tree
Showing 138 changed files with 1,884 additions and 1,543 deletions.
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ lazy val commonSettings = Seq(
scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 13)) =>
Seq("-Ywarn-unused:_,imports", "-Ywarn-unused:imports", "-release", "8")
Seq("-Ywarn-unused:_,imports", "-Ywarn-unused:imports", "-Wconf:src=src_managed/.*:silent", "-release", "8")
case Some((2, 12)) =>
Seq("-Ywarn-unused:_,imports", "-Ywarn-unused:imports", "-release", "8")
case Some((2, 11)) =>
Expand Down Expand Up @@ -282,7 +282,7 @@ lazy val interpreterJS = interpreter.js
},
Compile / npmDependencies ++= Seq(
"sigmajs-crypto-facade" -> sigmajsCryptoFacadeVersion,
"@fleet-sdk/common" -> "0.1.0-alpha.14"
"@fleet-sdk/common" -> "0.1.3"
)
)

Expand Down
7 changes: 0 additions & 7 deletions common/shared/src/main/scala/scalan/TypeDesc.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ object RType {
case ClassTag.Short => ShortType
case ClassTag.Int => IntType
case ClassTag.Long => LongType
case ClassTag.Char => CharType
case ClassTag.Float => FloatType
case ClassTag.Double => DoubleType
case ClassTag.Unit => UnitType
case _ => GeneralType[A](ctA)
}).asInstanceOf[RType[A]]
Expand Down Expand Up @@ -72,10 +69,6 @@ object RType {
implicit val ShortType : RType[Short] = PrimitiveType[Short] (ClassTag.Short, Array.emptyShortArray)
implicit val IntType : RType[Int] = PrimitiveType[Int] (ClassTag.Int, Array.emptyIntArray)
implicit val LongType : RType[Long] = PrimitiveType[Long] (ClassTag.Long, Array.emptyLongArray)
// TODO v5.x: optimize: remove Char, Float, Double types, they are not supported and will never be
implicit val CharType : RType[Char] = PrimitiveType[Char] (ClassTag.Char, Array.emptyCharArray)
implicit val FloatType : RType[Float] = PrimitiveType[Float] (ClassTag.Float, Array.emptyFloatArray)
implicit val DoubleType : RType[Double] = PrimitiveType[Double] (ClassTag.Double, Array.emptyDoubleArray)
implicit val UnitType : RType[Unit] = PrimitiveType[Unit] (ClassTag.Unit, Array[Unit]()(ClassTag.Unit))

implicit case object StringType extends RType[String] {
Expand Down
3 changes: 3 additions & 0 deletions common/shared/src/main/scala/scalan/util/CollectionUtil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ object CollectionUtil {
}

implicit class AnyOps[A](val x: A) extends AnyVal {
/** Performs a specified action on the source value and returns the result. */
def perform(action: A => A): A = action(x)

/** Traverses the tree structure in a depth-first manner using the provided function to generate child nodes.
*
* @param f a function that takes a node of type A and returns a list of its children
Expand Down
3 changes: 2 additions & 1 deletion common/shared/src/test/scala/scalan/BaseTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ abstract class BaseShouldTests extends AnyFlatSpec with TestUtils {
}
}

protected implicit def convertToInAndIgnoreMethods2(resultOfStringPassedToVerb: ResultOfStringPassedToVerb) =
protected implicit def convertToInAndIgnoreMethods2(
resultOfStringPassedToVerb: ResultOfStringPassedToVerb): InAndIgnoreMethods2 =
new InAndIgnoreMethods2(resultOfStringPassedToVerb)

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,14 @@ package object collection {
/** 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)

/** Conversion to underlying descriptor class.
* Allows syntax like
*
* ```val tColl: RType[Coll[A]] = ...; tColl.tItem```
*
* where `tItem` is a method of `CollType`, but is not defined on `RType`.
*/
implicit def downcastCollType[A](ct: RType[Coll[A]]): CollType[A] = ct.asInstanceOf[CollType[A]]

implicit val collBuilderRType: RType[CollBuilder] = RType.fromClassTag(classTag[CollBuilder])
}
16 changes: 5 additions & 11 deletions core-lib/shared/src/main/scala/special/sigma/SigmaDsl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,7 @@ trait BigInt {
def |(that: BigInt): BigInt = or(that)
}

/** Base class for points on elliptic curves.
*/
/** Base class for points on elliptic curves. */
trait GroupElement {
/** Checks if the provided element is an identity element. */
def isIdentity: Boolean
Expand Down Expand Up @@ -381,7 +380,6 @@ trait Box {
trait AvlTree {
/** Returns digest of the state represented by this tree.
* Authenticated tree digest = root hash bytes ++ tree height
* @since 2.0
*/
def digest: Coll[Byte]

Expand Down Expand Up @@ -529,10 +527,8 @@ trait AvlTreeVerifier {
}


/** Only header fields that can be predicted by a miner.
* @since 2.0
*/
trait PreHeader { // Testnet2
/** Only header fields that can be predicted by a miner. */
trait PreHeader {
/** Block version, to be increased on every soft and hardfork. */
def version: Byte

Expand All @@ -556,9 +552,7 @@ trait PreHeader { // Testnet2
def votes: Coll[Byte]
}

/** Represents data of the block header available in Sigma propositions.
* @since 2.0
*/
/** Represents data of the block header available in Sigma propositions. */
trait Header {
/** Bytes representation of ModifierId of this Header */
def id: Coll[Byte]
Expand All @@ -572,7 +566,7 @@ trait Header {
/** Hash of ADProofs for transactions in a block */
def ADProofsRoot: Coll[Byte] // Digest32. Can we build AvlTree out of it?

/** AvlTree) of a state after block application */
/** AvlTree of a state after block application */
def stateRoot: AvlTree

/** Root hash (for a Merkle tree) of transactions in a block. */
Expand Down
4 changes: 2 additions & 2 deletions core-lib/shared/src/test/scala/special/TypesTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class TypesTests extends BaseTests {
def test[A](t: RType[A], n: String) = {
t.name shouldBe n
}
test(tupleRType(Array(IntType, LongType, RType[(String, Double)], RType[Option[Boolean]])),
"(Int, Long, (String, Double), Option[Boolean])")
test(tupleRType(Array(IntType, LongType, RType[(Byte, special.sigma.BigInt)], RType[Option[Boolean]])),
"(Int, Long, (Byte, BigInt), Option[Boolean])")
}

test("RType implements equality") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,24 +433,6 @@ class CollsTests extends AnyPropSpec with ScalaCheckPropertyChecks with Matchers

checkColls(repl, coll)
}
forAll(charGen, indexGen, minSuccess) { (x, n) =>
val repl = builder.replicate(n, x)
val coll = builder.fromArray(Array.fill(n)(x))

checkColls(repl, coll)
}
forAll(floatGen, indexGen, minSuccess) { (x, n) =>
val repl = builder.replicate(n, x)
val coll = builder.fromArray(Array.fill(n)(x))

checkColls(repl, coll)
}
forAll (doubleGen, indexGen, minSuccess) { (x, n) =>
val repl = builder.replicate(n, x)
val coll = builder.fromArray(Array.fill(n)(x))

checkColls(repl, coll)
}
forAll (indexGen, minSuccess) { (n) =>
val replTrue = builder.replicate(n, true)
val collTrue = builder.fromArray(Array.fill(n)(true))
Expand Down Expand Up @@ -479,13 +461,13 @@ class CollsTests extends AnyPropSpec with ScalaCheckPropertyChecks with Matchers

checkColls(repl, coll)
}
forAll (byteGen, doubleGen, intGen, indexGen, minSuccess) { (b, d, i, n) =>
forAll (byteGen, longGen, intGen, indexGen, minSuccess) { (b, d, i, n) =>
val repl = builder.replicate(n, (b, (i, (d, b))))
val coll = builder.fromArray(Array.fill[(Byte, (Int, (Double, Byte)))](n)((b, (i, (d, b)))))
val coll = builder.fromArray(Array.fill[(Byte, (Int, (Long, Byte)))](n)((b, (i, (d, b)))))

checkColls(repl, coll)
}
forAll (byteGen, doubleGen, intGen, indexGen, indexGen, minSuccess) { (b, d, i, n, m) =>
forAll (byteGen, longGen, intGen, indexGen, indexGen, minSuccess) { (b, d, i, n, m) =>
val repl = builder.replicate(n, (b, ((i, (("string", builder.replicate(m, n)), Array(1, 2, 3, 4))), (d, b))))
val coll = builder.fromArray(Array.fill(n)((b, ((i, (("string", builder.fromArray(Array.fill(m)(n))), Array(1, 2, 3, 4))), (d, b)))))

Expand Down
Loading

0 comments on commit 75f301a

Please sign in to comment.