Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bumped scala to 2.13.7 #3586

Merged
merged 5 commits into from
Dec 22, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benchmark/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ enablePlugins(JmhPlugin)
Jmh / version := "1.33"

libraryDependencies ++= Seq(
"org.scodec" %% "scodec-core" % "1.11.8"
"org.scodec" %% "scodec-core" % "1.11.9"
) ++ Dependencies.logDeps

// https://github.com/ktoso/sbt-jmh#adding-to-your-project
Expand Down
7 changes: 5 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ lazy val repl = crossProject(JSPlatform, JVMPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Full)
.settings(
libraryDependencies ++= Dependencies.protobuf.value ++ Dependencies.langCompilerPlugins.value,
libraryDependencies ++= Dependencies.protobuf.value ++
Dependencies.langCompilerPlugins.value ++
Dependencies.circe.value,
inConfig(Compile)(
Seq(
PB.targets += scalapb.gen(flatPackage = true) -> sourceManaged.value,
Expand Down Expand Up @@ -119,13 +121,14 @@ lazy val root = (project in file("."))

inScope(Global)(
Seq(
scalaVersion := "2.13.6",
scalaVersion := "2.13.7",
organization := "com.wavesplatform",
organizationName := "Waves Platform",
V.fallback := (1, 4, 1),
organizationHomepage := Some(url("https://wavesplatform.com")),
licenses := Seq(("MIT", url("https://github.com/wavesplatform/Waves/blob/master/LICENSE"))),
scalacOptions ++= Seq(
"-Xsource:3",
"-feature",
"-deprecation",
"-unchecked",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class TransactionsApiGrpcImpl(blockchain: Blockchain, commonApi: CommonTransacti

override def getStateChanges(request: TransactionsRequest, responseObserver: StreamObserver[InvokeScriptResultResponse]): Unit =
responseObserver.interceptErrors {
val result = Observable(request.transactionIds: _*)
val result = Observable(request.transactionIds*)
.flatMap(txId => Observable.fromIterable(commonApi.transactionById(txId.toByteStr)))
.collect {
case TransactionMeta.Invoke(_, transaction, _, _, invokeScriptResult) =>
Expand All @@ -94,7 +94,7 @@ class TransactionsApiGrpcImpl(blockchain: Blockchain, commonApi: CommonTransacti

override def getStatuses(request: TransactionsByIdRequest, responseObserver: StreamObserver[TransactionStatus]): Unit =
responseObserver.interceptErrors {
val result = Observable(request.transactionIds: _*).map { txId =>
val result = Observable(request.transactionIds*).map { txId =>
commonApi
.unconfirmedTransactionById(txId.toByteStr)
.map(_ => TransactionStatus(txId, TransactionStatus.Status.UNCONFIRMED))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
package com.wavesplatform.api

import com.typesafe.scalalogging.Logger
import com.wavesplatform.account.{Address, AddressOrAlias}
import com.wavesplatform.api.http.ApiError
import com.wavesplatform.block as vb
import com.wavesplatform.lang.ValidationError
import com.wavesplatform.protobuf.block.{PBBlock, PBBlocks}
import com.wavesplatform.protobuf.transaction.{PBSignedTransaction, PBTransactions, VanillaTransaction}
import com.wavesplatform.state.Blockchain
import com.wavesplatform.utils.ScorexLogging
import com.wavesplatform.{block => vb}
import io.grpc.stub.{ServerCallStreamObserver, StreamObserver}
import monix.execution.atomic.AtomicAny
import monix.execution.{Ack, Scheduler}
import monix.reactive.Observable
import org.slf4j.LoggerFactory

import scala.concurrent.{ExecutionContext, Future, Promise}
import scala.util.control.NonFatal

package object grpc extends ScorexLogging {
package object grpc {
implicit class VanillaTransactionConversions(val tx: VanillaTransaction) extends AnyVal {
def toPB: PBSignedTransaction = PBTransactions.protobuf(tx)
}
Expand All @@ -29,6 +30,9 @@ package object grpc extends ScorexLogging {
def toPBHeader: PBBlock.Header = PBBlocks.protobuf(header)
}

protected lazy val logger: Logger =
Karasiq marked this conversation as resolved.
Show resolved Hide resolved
Logger(LoggerFactory.getLogger(getClass.getName))

implicit class StreamObserverMonixOps[T](val streamObserver: StreamObserver[T]) extends AnyVal {
def id: String =
Integer.toHexString(System.identityHashCode(streamObserver))
Expand All @@ -38,8 +42,8 @@ package object grpc extends ScorexLogging {

def failWith(error: Throwable): Unit = {
error match {
case _: IllegalArgumentException => log.warn(s"[${streamObserver.id}] gRPC call completed with error", error)
case _ => log.error(s"[${streamObserver.id}] gRPC call completed with error", error)
case _: IllegalArgumentException => logger.warn(s"[${streamObserver.id}] gRPC call completed with error", error)
case _ => logger.error(s"[${streamObserver.id}] gRPC call completed with error", error)
}

streamObserver.onError(GRPCErrors.toStatusException(error))
Expand Down Expand Up @@ -99,17 +103,17 @@ package object grpc extends ScorexLogging {
} else Future.failed(new IllegalStateException(s"An element ${nextItem()} is pending"))
},
err => cso.onError(err), { () =>
log.debug("Source observer completed")
logger.debug("Source observer completed")
cso.onCompleted()
}
)
cso.setOnCancelHandler { () =>
log.warn("Stream cancelled")
logger.warn("Stream cancelled")
cancelable.cancel()
}

case _ =>
log.warn(s"Unsupported StreamObserver type: $dest")
logger.warn(s"Unsupported StreamObserver type: $dest")
source.subscribe(
{ (elem: A) =>
dest.onNext(elem)
Expand Down
2 changes: 0 additions & 2 deletions lang/js/build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
scalaJSLinkerConfig ~= {
_.withModuleKind(ModuleKind.CommonJSModule)
}

libraryDependencies ++= Dependencies.circe.value
4 changes: 2 additions & 2 deletions lang/js/src/main/scala/JsAPI.scala
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ object JsAPI {
error => Seq("error" -> error),
_ => Seq()
)
js.Dynamic.literal.applyDynamic("apply")(resultFields ++ errorFieldOpt: _*)
js.Dynamic.literal.applyDynamic("apply")((resultFields ++ errorFieldOpt)*)
}
case Library =>
val ctx = buildScriptContext(version, isAsset, ds.contentType == DAppType)
Expand Down Expand Up @@ -308,7 +308,7 @@ object JsAPI {
_ => Seq()
)
}
js.Dynamic.literal.applyDynamic("apply")(resultFields ++ errorFieldOpt: _*)
js.Dynamic.literal.applyDynamic("apply")((resultFields ++ errorFieldOpt)*)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ object DirectiveParser {
val start = "{-#"
val end = "#-}"

private def space[_: P]: P[Unit] =
private def space[A: P]: P[Unit] =
P(CharIn(" ", "\t", "\r", "\n").rep)

private def directiveKeyP[_: P]: P[String] =
private def directiveKeyP[A: P]: P[String] =
P(CharIn("a-zA-Z0-9_"))
.repX(1)
.!

private def directiveValueP[_: P]: P[String] =
private def directiveValueP[A: P]: P[String] =
P(CharIn("a-zA-Z0-9/\\., "))
.repX(1)
.!

private def parser[_: P]: P[Either[ExecutionError, Directive]] =
private def parser[A: P]: P[Either[ExecutionError, Directive]] =
P(space ~ start ~ directiveKeyP ~ directiveValueP ~ end ~ space)
.map {
case (parsedKey, parsedValue) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.wavesplatform.lang.directives
import com.wavesplatform.lang.ExecutionError
import com.wavesplatform.lang.directives.values._

case class DirectiveSet private (
case class DirectiveSet(
stdLibVersion: StdLibVersion,
scriptType: ScriptType,
contentType: ContentType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class EvaluatorV1[F[_] : Monad, C[_[_]]](implicit ev: Monad[EvalF[F, *]], ev2: M

private def evalFuncBlock(func: FUNC, inner: EXPR): EvalM[F, C, (EvaluationContext[C, F], EVALUATED)] = {
val funcHeader = FunctionHeader.User(func.name)
val function = UserFunction(func.name, 0, NOTHING, func.args.map(n => (n, NOTHING)): _*)(func.body)
val function = UserFunction(func.name, 0, NOTHING, func.args.map(n => (n, NOTHING))*)(func.body)
.asInstanceOf[UserFunction[C]]
local {
modify[F, LoggedEvaluationContext[C, F], ExecutionError](funcs.modify(_)(_.updated(funcHeader, function)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ object NativeFunction {
def apply[C[_[_]]](name: String, cost: Long, internalName: Short, resultType: TYPE, args: (String, TYPE)*)(
evl: List[EVALUATED] => Either[ExecutionError, EVALUATED]
): NativeFunction[C] =
withEnvironment[C](name, cost, internalName, resultType, args: _*)(new ContextfulNativeFunction.Simple[C](name, resultType, args.toSeq) {
withEnvironment[C](name, cost, internalName, resultType, args*)(new ContextfulNativeFunction.Simple[C](name, resultType, args.toSeq) {
override def evaluate[F[_]: Monad](env: C[F], args: List[EVALUATED]): F[Either[ExecutionError, EVALUATED]] =
evl(args).pure[F]
})

def apply[C[_[_]]](name: String, costByLibVersion: Map[StdLibVersion, Long], internalName: Short, resultType: TYPE, args: (String, TYPE)*)(
evl: List[EVALUATED] => Either[ExecutionError, EVALUATED]
): NativeFunction[C] =
withEnvironment[C](name, costByLibVersion, internalName, resultType, args: _*)(new ContextfulNativeFunction.Simple[C](name, resultType, args.toSeq) {
withEnvironment[C](name, costByLibVersion, internalName, resultType, args*)(new ContextfulNativeFunction.Simple[C](name, resultType, args.toSeq) {
override def evaluate[F[_]: Monad](env: C[F], args: List[EVALUATED]): F[Either[ExecutionError, EVALUATED]] =
evl(args).pure[F]
})
Expand All @@ -97,24 +97,24 @@ object UserFunction {
internalName = name,
DirectiveDictionary[StdLibVersion].all.map(_ -> cost).toMap,
resultType,
args: _*
args*
)(ev)

def apply[C[_[_]]](name: String, cost: Long, resultType: TYPE, args: (String, TYPE)*)(ev: EXPR): UserFunction[C] =
UserFunction.withEnvironment[C](name, cost, resultType, args: _ *)(new ContextfulUserFunction[C] {
UserFunction.withEnvironment[C](name, cost, resultType, args*)(new ContextfulUserFunction[C] {
override def apply[F[_] : Monad](context: C[F], startArgs: List[EXPR]): EXPR = ev
})

def deprecated[C[_[_]]](name: String, cost: Long, resultType: TYPE, args: (String, TYPE)*)(ev: EXPR): UserFunction[C] =
UserFunction.deprecated(name, name, DirectiveDictionary[StdLibVersion].all.map(_ -> cost).toMap, resultType, args: _*)(ev)
UserFunction.deprecated(name, name, DirectiveDictionary[StdLibVersion].all.map(_ -> cost).toMap, resultType, args*)(ev)

def apply[C[_[_]]](name: String, costByLibVersion: Map[StdLibVersion, Long], resultType: TYPE, args: (String, TYPE)*)(
ev: EXPR): UserFunction[C] =
UserFunction(name, name, costByLibVersion, resultType, args: _*)(ev)
UserFunction(name, name, costByLibVersion, resultType, args*)(ev)

def apply[C[_[_]]](name: String, internalName: String, cost: Long, resultType: TYPE, args: (String, TYPE)*)(
ev: EXPR): UserFunction[C] =
UserFunction.withEnvironment[C](name, internalName, DirectiveDictionary[StdLibVersion].all.map(_ -> cost).toMap, resultType, args: _*)(
UserFunction.withEnvironment[C](name, internalName, DirectiveDictionary[StdLibVersion].all.map(_ -> cost).toMap, resultType, args*)(
ContextfulUserFunction.pure[C](ev)
)

Expand All @@ -141,7 +141,7 @@ object UserFunction {
resultType: TYPE,
args: (String, TYPE)*
)(ev: EXPR): UserFunction[C] =
withEnvironment[C](name, internalName, costByLibVersion, resultType, args: _*)(
withEnvironment[C](name, internalName, costByLibVersion, resultType, args*)(
ContextfulUserFunction.pure[C](ev)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ object CryptoContext {
)(body: List[EVALUATED] => Either[ExecutionError, EVALUATED]): Array[BaseFunction[NoContext]] = {
lim.zipWithIndex.map { n =>
val (sname, iname) = name(n)
NativeFunction[NoContext](sname, complexity(n._1), iname, ret, args: _*) { a =>
NativeFunction[NoContext](sname, complexity(n._1), iname, ret, args*) { a =>
check(n._1)(a).flatMap(_ => body(a))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1492,7 +1492,7 @@ object PureContext {
1,
(CREATE_TUPLE + resultSize - 2).toShort,
PARAMETERIZEDTUPLE(typeParams),
typeParams.mapWithIndex { case (typeParam, i) => (s"element${i + 1}", typeParam) }: _*
typeParams.mapWithIndex { case (typeParam, i) => (s"element${i + 1}", typeParam) }*
) {
case elements if elements.length == resultSize =>
val fields = elements.mapWithIndex { case (element, i) => (s"_${i + 1}", element) }.toMap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ object Functions {
Map[StdLibVersion, Long](V1 -> 100L, V2 -> 100L, V3 -> 100L, V4 -> 10L),
internalName,
UNION(dataType.innerType, UNIT),
args: _*
args*
) {
def getData[F[_]: Monad](env: Environment[F], addressOrAlias: CaseObj, key: String) = {
val environmentFunctions = new EnvironmentFunctions[F](env)
Expand Down Expand Up @@ -643,7 +643,7 @@ object Functions {
ExtractedFuncPrefix ++ f.header.toString,
f.costByLibVersionMap,
f.signature.result.asInstanceOf[UNION].typeList.find(_ != UNIT).get,
args: _*
args*
) {
val extractF = if (version >= V4) PureContext.value else PureContext.extract
FUNCTION_CALL(extractF, List(FUNCTION_CALL(f.header, args.map(a => REF(a._1)).toList)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ object Types {
) ::: callableTypes(version)

private val callableV3ReturnType =
UNION(callableV3Results: _*)
UNION(callableV3Results*)

private val callableV4ReturnType = {
val actions = LIST(UNION.create(commonDataEntryType(V4) :: deleteDataEntry :: scriptTransfer :: callableV4Actions))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import fastparse._

sealed abstract class BinaryOperation {
val func: String
def parser[_:P]: P[BinaryOperation] = P(func).map(_ => this)
def parser[A: P]: P[BinaryOperation] = P(func).map(_ => this)
def expr(start: Int, end: Int, op1: EXPR, op2: EXPR): EXPR = {
BINARY_OP(Pos(start, end), op1, this, op2)
}
Expand Down Expand Up @@ -46,7 +46,7 @@ object BinaryOperation {
}
case object GT_OP extends BinaryOperation {
val func = ">"
override def parser[_:P] = P(">" ~ !P("=")).map(_ => this)
override def parser[A: P] = P(">" ~ !P("=")).map(_ => this)
}
case object SUM_OP extends BinaryOperation {
val func = "+"
Expand All @@ -65,14 +65,14 @@ object BinaryOperation {
}
case object LE_OP extends BinaryOperation {
val func = ">="
override def parser[_:P] = P("<=").map(_ => this)
override def parser[A: P] = P("<=").map(_ => this)
override def expr(start: Int, end: Int, op1: EXPR, op2: EXPR): EXPR = {
BINARY_OP(Pos(start, end), op2, LE_OP, op1)
}
}
case object LT_OP extends BinaryOperation {
val func = ">"
override def parser[_:P] = P("<" ~ !P("=")).map(_ => this)
override def parser[A: P] = P("<" ~ !P("=")).map(_ => this)
override def expr(start: Int, end: Int, op1: EXPR, op2: EXPR): EXPR = {
BINARY_OP(Pos(start, end), op2, LT_OP, op1)
}
Expand Down
Loading