Skip to content

Commit

Permalink
Merge pull request #691 from ScorexFoundation/develop
Browse files Browse the repository at this point in the history
Release v3.3.1
  • Loading branch information
aslesarenko authored Sep 28, 2020
2 parents f5420ca + 6c691d1 commit ff3df1b
Show file tree
Hide file tree
Showing 137 changed files with 4,648 additions and 3,094 deletions.
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ lazy val rootSettings = Seq(
)

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

log.info(s"Testing current build in Ergo (branch $ergoBranch):")
Expand Down Expand Up @@ -354,7 +354,7 @@ commands += Command.command("ergoItTest") { state =>
}

def runSpamTestTask(task: String, sigmastateVersion: String, log: Logger): Unit = {
val spamBranch = "revert-23-revert-22-serialize-opt"
val spamBranch = "master"
val envVars = Seq("SIGMASTATE_VERSION" -> sigmastateVersion,
"SPECIAL_VERSION" -> specialVersion,
// SSH_SPAM_REPO_KEY should be set (see Jenkins Credentials Binding Plugin)
Expand Down
31 changes: 20 additions & 11 deletions common/src/main/scala/scalan/TypeDesc.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ package scalan
import scala.reflect.ClassTag
import scala.annotation.implicitNotFound

/** Base type for all runtime type descriptors. */
/** Base type for all runtime type descriptors. Sigma uses type descriptors to
* represent structure of the data values. Data values of registers and context
* variables come equipped with type descriptors in order to check the actual type
* is the same as the type expected by the script.
* @see [[getReg]], [[getVar]]
*/
@implicitNotFound(msg = "No RType available for ${A}.")
abstract class RType[A] {
/** Class tag suitable for construct instances of Array[A]. */
Expand All @@ -15,6 +20,9 @@ abstract class RType[A] {
/** Returns true is data size of `x: A` is the same for all `x`.
* This is useful optimizations of calculating sizes of collections. */
def isConstantSize: Boolean

/** Creates empty immutable array of this type. */
def emptyArray: Array[A] = Array.empty[A](classTag)
}

object RType {
Expand Down Expand Up @@ -56,7 +64,8 @@ object RType {
}

/** Descriptor used to represent primitive types. */
case class PrimitiveType[A](classTag: ClassTag[A]) extends RType[A] {
case class PrimitiveType[A](classTag: ClassTag[A],
override val emptyArray: Array[A]) extends RType[A] {
override def name: String = classTag.toString()
/** We assume all primitive types have inhabitants of the same size. */
override def isConstantSize: Boolean = true
Expand All @@ -66,15 +75,15 @@ object RType {
val AnyRefType : RType[AnyRef] = GeneralType[AnyRef] (ClassTag.AnyRef)
val NothingType : RType[Nothing] = GeneralType[Nothing] (ClassTag.Nothing)

implicit val BooleanType : RType[Boolean] = PrimitiveType[Boolean] (ClassTag.Boolean)
implicit val ByteType : RType[Byte] = PrimitiveType[Byte] (ClassTag.Byte)
implicit val ShortType : RType[Short] = PrimitiveType[Short] (ClassTag.Short)
implicit val IntType : RType[Int] = PrimitiveType[Int] (ClassTag.Int)
implicit val LongType : RType[Long] = PrimitiveType[Long] (ClassTag.Long)
implicit val CharType : RType[Char] = PrimitiveType[Char] (ClassTag.Char)
implicit val FloatType : RType[Float] = PrimitiveType[Float] (ClassTag.Float)
implicit val DoubleType : RType[Double] = PrimitiveType[Double] (ClassTag.Double)
implicit val UnitType : RType[Unit] = PrimitiveType[Unit] (ClassTag.Unit)
implicit val BooleanType : RType[Boolean] = PrimitiveType[Boolean] (ClassTag.Boolean, Array.emptyBooleanArray)
implicit val ByteType : RType[Byte] = PrimitiveType[Byte] (ClassTag.Byte, Array.emptyByteArray)
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)
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))

/** Descriptor of the type A narrowed to the single inhabitant `value`. */
case class SingletonType[A](value: A, classTag: ClassTag[A])() extends RType[A] {
Expand Down
10 changes: 5 additions & 5 deletions core/src/main/scala/scalan/Entities.scala
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package scalan

import java.util.Objects

import scala.annotation.tailrec
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 =>

/** Base class for all descriptors of staged traits. */
/** Base class for all descriptors of staged traits.
* See derived classes in `impl` packages.
*/
abstract class EntityElem[A] extends Elem[A] with scala.Equals {
/** Optional parent type in inheritance hierarchy */
def parent: Option[Elem[_]] = None
Expand All @@ -28,7 +28,7 @@ trait Entities extends TypeDescs { self: Scalan =>
case _ => false
})

override def hashCode = Objects.hash(getClass, typeArgsDescs)
override def hashCode = getClass.hashCode() * 31 + typeArgsDescs.hashCode()
}

/** Base class for all descriptors of staged traits with one type parameter. */
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/scalan/staged/ProgramGraphs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ trait ProgramGraphs extends AstGraphs { self: Scalan =>
val res = DBuffer.ofSize[Int](len)
cfor(0)(_ < len, _ + 1) { i =>
val sym = deps(i)
if (pred(sym) && !sym.isVar) // TODO remove isVar condition here and below
if (pred(sym) && !sym.isVar) // TODO optimize: remove isVar condition here and below
res += sym.node.nodeId
}
res
Expand Down
16 changes: 5 additions & 11 deletions docs/sigmastate_protocols/sigmastate_protocols.bib
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,7 @@ @misc{zcash1
howpublished = {\url{https://z.cash}}
}

@misc{advtutorial,
year = {2019},
month = {03},
title = {Advanced ErgoScript Tutorial},
howpublished = {\url{https://docs.ergoplatform.com/sigmastate_protocols.pdf}}
}
@misc{tutorial,
@misc{whitepaper,
year = {2019},
month = {03},
title = {ErgoScript, a Cryptocurrency Scripting Language Supporting Noninteractive Zero-Knowledge Proofs},
Expand All @@ -118,7 +112,7 @@ @misc{coinjoin

@misc{langrepo,
author = {Scorex Foundation},
title = {Sigmastate Interpretter (ErgoScript)},
title = {Sigmastate Interpretter},
year = {2017},
publisher = {GitHub},
journal = {GitHub repository},
Expand Down Expand Up @@ -1365,7 +1359,7 @@ @article{kokoris2016enhancing

@inproceedings{aumasson2013blake2,
title={{BLAKE2}: simpler, smaller, fast as {MD5}},
author={Aumasson, Jean-Philippe and Neves, Samuel and Wilcox-O’Hearn, Zooko and Winnerlein, Christian},
author={Aumasson, Jean-Philippe and Neves, Samuel and Wilcox-O’Hearn, Zooko and Winnerlein, Christian},
booktitle={International Conference on Applied Cryptography and Network Security},
pages={119--135},
year={2013},
Expand Down Expand Up @@ -1408,8 +1402,8 @@ @misc{fivehrs
}

@misc{ethattacks,
title={Ethereum Network Attacker’s IP Address Is Traceable},
title={Ethereum Network Attacker’s IP Address Is Traceable},
author={Bok Khoo},
year=2016,
note={\url{https://www.bokconsulting.com.au/blog/ethereum-network-attackers-ip-address-is-traceable/}}
}
}
Binary file modified docs/sigmastate_protocols/sigmastate_protocols.pdf
Binary file not shown.
Loading

0 comments on commit ff3df1b

Please sign in to comment.