Skip to content
This repository has been archived by the owner on Apr 13, 2022. It is now read-only.

Update scorex-util and scrypto deps, fix tests #391

Merged
merged 2 commits into from
Nov 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,21 @@ val loggingDependencies = Seq(
"ch.qos.logback" % "logback-classic" % "1.3.0-alpha4"
)

val scorexUtil = "org.scorexfoundation" %% "scorex-util" % "0.1.6"
val scorexUtil = "org.scorexfoundation" %% "scorex-util" % "0.1.8"

val testingDependencies = Seq(
"com.typesafe.akka" %% "akka-testkit" % akkaVersion % "test",
"com.typesafe.akka" %% "akka-http-testkit" % akkaHttpVersion % "test",
"org.scalactic" %% "scalactic" % "3.0.3" % "test",
"org.scalatest" %% "scalatest" % "3.0.3" % "test",
"org.scalacheck" %% "scalacheck" % "1.13.+",
"org.scalatest" %% "scalatest" % "3.1.1" % "test",
"org.scalacheck" %% "scalacheck" % "1.14.+",
"org.scalatestplus" %% "scalatestplus-scalacheck" % "3.1.0.0-RC2" % Test,
scorexUtil, (scorexUtil % Test).classifier("tests")
)

libraryDependencies ++= Seq(
"com.iheart" %% "ficus" % "1.4.2",
"org.scorexfoundation" %% "scrypto" % "2.1.7",
"org.scorexfoundation" %% "scrypto" % "2.1.10",
scorexUtil
) ++ networkDependencies ++ apiDependencies ++ loggingDependencies ++ testingDependencies

Expand Down
5 changes: 3 additions & 2 deletions examples/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ name := "scorex-examples"

libraryDependencies ++= Seq(
"org.scalactic" %% "scalactic" % "3.0.1" % "test",
"org.scalatest" %% "scalatest" % "3.0.1" % "test",
"org.scalacheck" %% "scalacheck" % "1.13.+" % "test",
"org.scalatest" %% "scalatest" % "3.1.1" % "test",
"org.scalacheck" %% "scalacheck" % "1.14.+" % "test",
"org.scalatestplus" %% "scalatestplus-scalacheck" % "3.1.0.0-RC2" % Test,
"org.scorexfoundation" %% "iodb" % "0.3.2",
"com.typesafe.akka" %% "akka-testkit" % "2.6.10" % "test"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ package hybrid.history
import examples.hybrid.history.{HybridHistory, HybridSyncInfo}
import hybrid.HybridGenerators
import org.scalacheck.Gen
import org.scalatest.prop.{GeneratorDrivenPropertyChecks, PropertyChecks}
import org.scalatest.{Matchers, PropSpec}
import scorex.core.consensus.History.{Equal, HistoryComparisonResult, Older, Younger}
import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec
import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks
import scorex.core.consensus.History.{Older, HistoryComparisonResult, Equal, Younger}
import scorex.core.utils.ScorexEncoding
import scorex.core.ModifierTypeId
import scorex.util.ModifierId

@SuppressWarnings(Array("org.wartremover.warts.TraversableOps", "org.wartremover.warts.OptionPartial"))
class HybridHistorySpecification extends PropSpec
with PropertyChecks
with GeneratorDrivenPropertyChecks
class HybridHistorySpecification extends AnyPropSpec
with ScalaCheckPropertyChecks
with Matchers
with HybridGenerators
with ScorexEncoding {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ import examples.hybrid.blocks.{HybridBlock, PosBlock, PowBlock}
import hybrid.HybridGenerators
import io.iohk.iodb.{ByteArrayWrapper, LSMStore}
import org.scalacheck.Gen
import org.scalatest.prop.GeneratorDrivenPropertyChecks
import org.scalatest.{Matchers, Outcome, fixture}
import org.scalatest.matchers.should.Matchers
import org.scalatest.{fixture, Outcome}
import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks
import scorex.core.utils.ScorexEncoding
import scorex.testkit.utils.FileUtils
import scorex.util.ModifierId

@SuppressWarnings(Array("org.wartremover.warts.TraversableOps"))
class IODBSpecification extends fixture.PropSpec
with GeneratorDrivenPropertyChecks
with ScalaCheckPropertyChecks
with Matchers
with HybridGenerators
with FileUtils
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package hybrid.primitives

import examples.commons.PublicKey25519NoncedBox
import hybrid.HybridGenerators
import org.scalatest.prop.{GeneratorDrivenPropertyChecks, PropertyChecks}
import org.scalatest.{Matchers, PropSpec}
import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec
import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks
import scorex.core.transaction.state.PrivateKey25519Companion

@SuppressWarnings(Array("org.wartremover.warts.OptionPartial"))
class PrivateKey25519Suite extends PropSpec
with PropertyChecks
with GeneratorDrivenPropertyChecks
class PrivateKey25519Suite extends AnyPropSpec
with ScalaCheckPropertyChecks
with Matchers
with HybridGenerators {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import examples.commons.{PublicKey25519NoncedBox, PublicKey25519NoncedBoxSeriali
import examples.hybrid.blocks.{PosBlock, PosBlockSerializer, PowBlock, PowBlockSerializer}
import examples.hybrid.history.{HybridSyncInfo, HybridSyncInfoSerializer}
import hybrid.HybridGenerators
import org.scalatest.prop.{GeneratorDrivenPropertyChecks, PropertyChecks}
import org.scalatest.{Matchers, PropSpec}
import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec
import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks
import scorex.core.transaction.box.proposition.PublicKey25519Proposition
import scorex.core.transaction.wallet.{WalletBox, WalletBoxSerializer}

@SuppressWarnings(Array("org.wartremover.warts.TraversableOps"))
class SerializationTests extends PropSpec
with PropertyChecks
with GeneratorDrivenPropertyChecks
class SerializationTests extends AnyPropSpec
with ScalaCheckPropertyChecks
with Matchers
with HybridGenerators {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ package hybrid.state
import examples.hybrid.blocks.HybridBlock
import examples.hybrid.state.HBoxStoredState
import hybrid.HybridGenerators
import org.scalatest.prop.{GeneratorDrivenPropertyChecks, PropertyChecks}
import org.scalatest.{Matchers, PropSpec}
import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec
import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks
import scorex.core.transaction.state.{Insertion, Removal}
import scorex.testkit.properties.state.StateTests

@SuppressWarnings(Array("org.wartremover.warts.OptionPartial"))
class HBoxStoredStateSpecification extends PropSpec
with PropertyChecks
with GeneratorDrivenPropertyChecks
class HBoxStoredStateSpecification extends AnyPropSpec
with ScalaCheckPropertyChecks
with Matchers
with HybridGenerators
with StateTests[HybridBlock, HBoxStoredState] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package hybrid.state
import examples.commons.{Nonce, PublicKey25519NoncedBox, SimpleBoxTransaction, Value}
import examples.hybrid.state.HBoxStoredState
import hybrid.HybridGenerators
import org.scalatest.prop.{GeneratorDrivenPropertyChecks, PropertyChecks}
import org.scalatest.{Matchers, PropSpec}
import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec
import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks
import scorex.core.transaction.box.proposition.PublicKey25519Proposition
import scorex.core.transaction.proof.{Signature25519, Signature25519Serializer}
import scorex.core.transaction.state.PrivateKey25519Companion
Expand All @@ -13,9 +14,8 @@ import scorex.crypto.hash.Sha256
import scorex.crypto.signatures.{PublicKey, Signature}

@SuppressWarnings(Array("org.wartremover.warts.TraversableOps"))
class SimpleBoxTransactionSpecification extends PropSpec
with PropertyChecks
with GeneratorDrivenPropertyChecks
class SimpleBoxTransactionSpecification extends AnyPropSpec
with ScalaCheckPropertyChecks
with Matchers
with HybridGenerators {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package hybrid.transaction
import examples.commons.SimpleBoxTransaction
import hybrid.HybridGenerators
import io.iohk.iodb.ByteArrayWrapper
import org.scalatest.prop.{GeneratorDrivenPropertyChecks, PropertyChecks}
import org.scalatest.{Matchers, PropSpec}
import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec
import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks
import scorex.core.transaction.state.PrivateKey25519Companion


class TransactionSuite extends PropSpec
with PropertyChecks
with GeneratorDrivenPropertyChecks
class TransactionSuite extends AnyPropSpec
with ScalaCheckPropertyChecks
with Matchers
with HybridGenerators {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package hybrid.validation

import examples.hybrid.validation.SemanticBlockValidator
import hybrid.HybridGenerators
import org.scalatest.prop.{GeneratorDrivenPropertyChecks, PropertyChecks}
import org.scalatest.{Matchers, PropSpec}
import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec
import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks
import scorex.crypto.hash.Blake2b256


class SemanticBlockValidatorSpecification extends PropSpec
with PropertyChecks
with GeneratorDrivenPropertyChecks
class SemanticBlockValidatorSpecification extends AnyPropSpec
with ScalaCheckPropertyChecks
with Matchers
with HybridGenerators {

Expand Down
10 changes: 5 additions & 5 deletions examples/src/test/scala/hybrid/wallet/HWalletSpecification.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import examples.commons.Value
import examples.hybrid.blocks.PosBlock
import examples.hybrid.wallet.HBoxWallet
import hybrid.HybridGenerators
import org.scalatest.prop.{GeneratorDrivenPropertyChecks, PropertyChecks}
import org.scalatest.{Matchers, PropSpec}
import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec
import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks
import scorex.core.bytesToId
import scorex.core.transaction.box.proposition.PublicKey25519Proposition
import scorex.core.transaction.proof.Signature25519
Expand All @@ -16,9 +17,8 @@ import scala.annotation.tailrec
import scala.util.Random

@SuppressWarnings(Array("org.wartremover.warts.TraversableOps"))
class HWalletSpecification extends PropSpec
with PropertyChecks
with GeneratorDrivenPropertyChecks
class HWalletSpecification extends AnyPropSpec
with ScalaCheckPropertyChecks
with Matchers
with HybridGenerators {

Expand Down
10 changes: 5 additions & 5 deletions examples/src/test/scala/spv/ChainTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ package spv
import examples.spv.simulation.SimulatorFuctions
import examples.spv.{Header, KLS16ProofSerializer, KMZProofSerializer, SpvAlgos}
import org.scalacheck.Gen
import org.scalatest.prop.{GeneratorDrivenPropertyChecks, PropertyChecks}
import org.scalatest.{Matchers, PropSpec}
import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec
import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks
import scorex.core.transaction.box.proposition.PublicKey25519Proposition
import scorex.core.transaction.state.{PrivateKey25519, PrivateKey25519Companion}
import scorex.crypto.hash
import scorex.crypto.hash.Blake2b256
import scorex.util.ModifierId

@SuppressWarnings(Array("org.wartremover.warts.TraversableOps"))
class ChainTests extends PropSpec
with PropertyChecks
with GeneratorDrivenPropertyChecks
class ChainTests extends AnyPropSpec
with ScalaCheckPropertyChecks
with Matchers
with SPVGenerators
with SimulatorFuctions {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package spv.serialization

import examples.spv.{Header, HeaderSerializer}
import org.scalatest.prop.{GeneratorDrivenPropertyChecks, PropertyChecks}
import org.scalatest.{Matchers, PropSpec}
import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec
import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks
import spv.SPVGenerators

class SerializationTests extends PropSpec
with PropertyChecks
with GeneratorDrivenPropertyChecks
class SerializationTests extends AnyPropSpec
with ScalaCheckPropertyChecks
with Matchers
with SPVGenerators {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package trimchain.serialization

import examples.trimchain.core.{Ticket, TicketSerializer}
import examples.trimchain.modifiers.{BlockHeader, BlockHeaderSerializer, TBlock, TBlockSerializer}
import org.scalatest.prop.{GeneratorDrivenPropertyChecks, PropertyChecks}
import org.scalatest.{Matchers, PropSpec}
import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec
import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks
import trimchain.TrimchainGenerators

class SerializationTests extends PropSpec
with PropertyChecks
with GeneratorDrivenPropertyChecks
class SerializationTests extends AnyPropSpec
with ScalaCheckPropertyChecks
with Matchers
with TrimchainGenerators {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class VLQByteStringReader(byteString: ByteString) extends VLQReader {

@inline
override def getBytes(size: Int): Array[Byte] = {
require(size <= remaining, s"Not enough bytes in the buffer: $size")
incPosition(size)
it.getBytes(size)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ class VLQByteStringWriter extends VLQWriter {
this
}

override def putBytes(xs: Array[Byte],
offset: Int,
length: Int): VLQByteStringWriter.this.type = {
builder.putBytes(xs, offset, length)
this
}

@inline
override def putBytes(xs: Array[Byte]): this.type = {
builder.putBytes(xs)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package scorex.core

import org.scalatest.{Matchers, PropSpec}
import org.scalatest.prop.{GeneratorDrivenPropertyChecks, PropertyChecks}
import scorex.core.consensus.{History, HistoryReader, ModifierSemanticValidity, SyncInfo}
import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec
import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks
import scorex.core.consensus.{SyncInfo, History, HistoryReader, ModifierSemanticValidity}
import scorex.core.consensus.History.ModifierIds
import scorex.core.serialization.ScorexSerializer
import scorex.crypto.hash.Blake2b256

import scala.util.Try

class DefaultModifiersCacheSpecification extends PropSpec
with PropertyChecks
with GeneratorDrivenPropertyChecks
class DefaultModifiersCacheSpecification extends AnyPropSpec
with ScalaCheckPropertyChecks
with Matchers {

private class FakeModifier extends PersistentNodeViewModifier {
Expand Down
5 changes: 3 additions & 2 deletions src/test/scala/scorex/core/api/http/ApiResponseTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import akka.http.scaladsl.model.{HttpRequest, StatusCodes}
import akka.http.scaladsl.testkit.ScalatestRouteTest
import io.circe.Json
import io.circe.syntax._
import org.scalatest.{FlatSpec, Matchers}
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers

import scala.concurrent.Future

class ApiResponseTest extends FlatSpec with Matchers with ScalatestRouteTest {
class ApiResponseTest extends AnyFlatSpec with Matchers with ScalatestRouteTest {

private val request = HttpRequest()

Expand Down
9 changes: 5 additions & 4 deletions src/test/scala/scorex/core/api/http/PeersApiRouteSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@ package scorex.core.api.http

import java.net.InetSocketAddress

import akka.http.scaladsl.model.{ContentTypes, HttpEntity, StatusCodes}
import akka.http.scaladsl.testkit.{RouteTestTimeout, ScalatestRouteTest}
import akka.http.scaladsl.model.{ContentTypes, StatusCodes, HttpEntity}
import akka.http.scaladsl.testkit.{ScalatestRouteTest, RouteTestTimeout}
import akka.testkit.TestDuration
import io.circe.Json
import io.circe.syntax._
import org.scalatest.{FlatSpec, Matchers}
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers
import scorex.core.api.http.PeersApiRoute.PeerInfoResponse
import scorex.core.settings.{RESTApiSettings, ScorexSettings}
import scorex.core.utils.NetworkTimeProvider

import scala.concurrent.duration._
import scala.language.postfixOps

class PeersApiRouteSpec extends FlatSpec
class PeersApiRouteSpec extends AnyFlatSpec
with Matchers
with ScalatestRouteTest
with Stubs {
Expand Down