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 dependencies #3981

Merged
merged 6 commits into from
Jan 13, 2025
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/push-default-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
cache: 'sbt'
- uses: sbt/setup-sbt@v1
- uses: scalacenter/sbt-dependency-submission@v3
with:
configs-ignore: test compile-internal provided
Expand All @@ -33,5 +39,5 @@ jobs:
SONATYPE_USERNAME: ${{ secrets.OSSRH_USERNAME }}
PGP_PASSPHRASE: ${{ secrets.OSSRH_GPG_PASSPHRASE }}
run: |
version=$(echo ${{ github.ref }} | awk -F '[-.]' '{print $2"."$3}')-SNAPSHOT
version=$(awk -F '[".]' '{print $3"."$4"."$5+1}' version.sbt)-SNAPSHOT
sbt -Dproject.version=$version --mem 4096 --batch publishSigned
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ lazy val `waves-node` = (project in file("."))

inScope(Global)(
Seq(
scalaVersion := "2.13.15",
scalaVersion := "2.13.16",
organization := "com.wavesplatform",
organizationName := "Waves Platform",
organizationHomepage := Some(url("https://wavesplatform.com")),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.wavesplatform.lang

import com.google.common.base.Charsets
import com.google.common.io
import com.wavesplatform.lang.v1.estimator.v3.ScriptEstimatorV3

import java.io.File
import java.nio.charset.StandardCharsets

object FileCompiler extends App {
private val estimator = ScriptEstimatorV3.latest
Expand All @@ -19,12 +19,12 @@ object FileCompiler extends App {
pathname.isFile && pathname.getAbsoluteFile != scriptFile
})
.map { f =>
f.getName -> io.Files.asCharSource(f, Charsets.UTF_8).read()
f.getName -> io.Files.asCharSource(f, StandardCharsets.UTF_8).read()
}
.toMap

API
.compile(io.Files.asCharSource(scriptFile, Charsets.UTF_8).read(), estimator, libraries = imports)
.compile(io.Files.asCharSource(scriptFile, StandardCharsets.UTF_8).read(), estimator, libraries = imports)
.fold(
error => throw new RuntimeException(s"$error while compiling $path"),
_ => println(s"successfully compiled $path")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import cats.implicits.*
import cats.{Id, Monad}
import com.wavesplatform.common.merkle.Merkle.createRoot
import com.wavesplatform.common.state.ByteStr
import com.wavesplatform.lang.*
import com.wavesplatform.lang.directives.values.*
import com.wavesplatform.lang.v1.compiler.Terms.*
import com.wavesplatform.lang.v1.compiler.Types.*
Expand All @@ -14,7 +15,6 @@ import com.wavesplatform.lang.v1.evaluator.FunctionIds.*
import com.wavesplatform.lang.v1.evaluator.ctx.impl.crypto.RSA.DigestAlgorithm
import com.wavesplatform.lang.v1.evaluator.ctx.{BaseFunction, EvaluationContext, NativeFunction}
import com.wavesplatform.lang.v1.{BaseGlobal, CTX}
import com.wavesplatform.lang.*

import scala.collection.mutable
import scala.util.Try
Expand Down Expand Up @@ -50,7 +50,7 @@ object CryptoContext {
}
)

private val ctxCache = mutable.AnyRefMap.empty[(BaseGlobal, StdLibVersion), CTX[NoContext]]
private val ctxCache = mutable.HashMap.empty[(BaseGlobal, StdLibVersion), CTX[NoContext]]

private def buildNew(global: BaseGlobal, version: StdLibVersion): CTX[NoContext] = {
def functionFamily(
Expand Down Expand Up @@ -373,8 +373,7 @@ object CryptoContext {
case xs @ ARR(proof) :: CONST_BYTESTR(value) :: CONST_LONG(index) :: Nil =>
val sizeCheckedProofs = proof.collect { case bs @ CONST_BYTESTR(v) if v.size == 32 => bs }
if (value.size == 32 && proof.length <= 16 && sizeCheckedProofs.size == proof.size) {
Try(createRoot(value.arr, Math.toIntExact(index), sizeCheckedProofs.reverse.map(_.bs.arr)))
.toEither
Try(createRoot(value.arr, Math.toIntExact(index), sizeCheckedProofs.reverse.map(_.bs.arr))).toEither
.leftMap(e => ThrownError(if (e.getMessage != null) e.getMessage else "error"))
.flatMap(r => CONST_BYTESTR(ByteStr(r)))
} else {
Expand Down
99 changes: 48 additions & 51 deletions node/src/main/scala/com/wavesplatform/ResponsivenessLogs.scala
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
package com.wavesplatform

import java.io.{FileOutputStream, PrintWriter}
import java.time.LocalDate
import java.time.format.DateTimeFormatter

import scala.collection.mutable
import scala.concurrent.duration.Duration
import scala.util.Try

import com.wavesplatform.account.Address
import com.wavesplatform.common.state.ByteStr
import com.wavesplatform.lang.ValidationError
import com.wavesplatform.metrics.Metrics
import com.wavesplatform.transaction.{AuthorizedTransaction, Transaction, TxValidationError}
import com.wavesplatform.transaction.smart.InvokeScriptTransaction
import com.wavesplatform.transaction.{AuthorizedTransaction, Transaction, TxValidationError}
import com.wavesplatform.utils.ScorexLogging
import org.influxdb.dto.Point

import java.io.{FileOutputStream, PrintWriter}
import java.time.LocalDate
import java.time.format.DateTimeFormatter
import scala.collection.mutable
import scala.concurrent.duration.Duration
import scala.util.Try

private class ResponsivenessLogs(csvPrefix: String, metricName: String) extends ScorexLogging {
import ResponsivenessLogs.TxEvent

//noinspection ScalaStyle
// noinspection ScalaStyle
private[this] case class MetricSnapshot(point: Point.Builder = null, nano: Long = System.nanoTime(), millis: Long = System.currentTimeMillis())

private[this] case class TxState(
Expand All @@ -32,7 +31,7 @@ private class ResponsivenessLogs(csvPrefix: String, metricName: String) extends
miningAttempt: Int,
height: Int
)
private[this] val stateMap = mutable.AnyRefMap.empty[ByteStr, TxState]
private[this] val stateMap = mutable.HashMap.empty[ByteStr, TxState]

def writeEvent(
height: Int,
Expand Down Expand Up @@ -76,48 +75,46 @@ private class ResponsivenessLogs(csvPrefix: String, metricName: String) extends
.addField("height", height)

if (eventType == TxEvent.Mined) {
stateMap.get(tx.id()).foreach {
case TxState(received, lastReceived, firstMined, _, _, attempt, _) =>
val delta = toMillis(nowNanos - received)
val lastDelta = toMillis(nowNanos - lastReceived)
log.trace(s"Neutrino mining time for ${tx.id()} (attempt #$attempt): $delta ms ($lastDelta from last recv)")

val snapshot = MetricSnapshot(basePoint.addField("time-to-mine", delta).addField("time-to-last-mine", lastDelta), nowNanos)
stateMap(tx.id()) = TxState(
received,
lastReceived,
firstMined.orElse(Some(snapshot)),
Some(snapshot),
None,
attempt,
height
)
stateMap.get(tx.id()).foreach { case TxState(received, lastReceived, firstMined, _, _, attempt, _) =>
val delta = toMillis(nowNanos - received)
val lastDelta = toMillis(nowNanos - lastReceived)
log.trace(s"Neutrino mining time for ${tx.id()} (attempt #$attempt): $delta ms ($lastDelta from last recv)")

val snapshot = MetricSnapshot(basePoint.addField("time-to-mine", delta).addField("time-to-last-mine", lastDelta), nowNanos)
stateMap(tx.id()) = TxState(
received,
lastReceived,
firstMined.orElse(Some(snapshot)),
Some(snapshot),
None,
attempt,
height
)
}
} else if (eventType == TxEvent.Expired || (eventType == TxEvent.Invalidated && !isAlreadyInTheState)) {
stateMap.get(tx.id()).foreach {
case st @ TxState(received, lastReceived, firstMined, _, _, _, _) =>
val delta = toMillis(nowNanos - received)
val lastDelta = toMillis(nowNanos - lastReceived)
log.trace(s"Neutrino fail time for ${tx.id()}: $delta ms")

val baseFailedPoint = basePoint
.tag("reason", reasonClass)
.addField("time-to-fail", delta)
.addField("time-to-last-fail", lastDelta)

val failedPoint = firstMined match {
case Some(ms) =>
val ffDelta = toMillis(nowNanos - ms.nano)
val firstDelta = toMillis(ms.nano - received)
baseFailedPoint
.addField("time-to-first-mine", firstDelta)
.addField("time-to-finish-after-first-mining", ffDelta)

case None =>
baseFailedPoint
}

stateMap(tx.id()) = st.copy(failed = Some(MetricSnapshot(failedPoint)))
stateMap.get(tx.id()).foreach { case st @ TxState(received, lastReceived, firstMined, _, _, _, _) =>
val delta = toMillis(nowNanos - received)
val lastDelta = toMillis(nowNanos - lastReceived)
log.trace(s"Neutrino fail time for ${tx.id()}: $delta ms")

val baseFailedPoint = basePoint
.tag("reason", reasonClass)
.addField("time-to-fail", delta)
.addField("time-to-last-fail", lastDelta)

val failedPoint = firstMined match {
case Some(ms) =>
val ffDelta = toMillis(nowNanos - ms.nano)
val firstDelta = toMillis(ms.nano - received)
baseFailedPoint
.addField("time-to-first-mine", firstDelta)
.addField("time-to-finish-after-first-mining", ffDelta)

case None =>
baseFailedPoint
}

stateMap(tx.id()) = st.copy(failed = Some(MetricSnapshot(failedPoint)))
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.wavesplatform.api.common

import com.google.common.base.Charsets
import com.google.common.collect.AbstractIterator
import com.wavesplatform.account.{Address, Alias}
import com.wavesplatform.api.common.AddressPortfolio.{assetBalanceIterator, nftIterator}
Expand All @@ -15,6 +14,7 @@ import monix.eval.Task
import monix.reactive.Observable
import org.rocksdb.RocksIterator

import java.nio.charset.StandardCharsets
import java.util.regex.Pattern
import scala.annotation.tailrec
import scala.jdk.CollectionConverters.*
Expand Down Expand Up @@ -178,7 +178,7 @@ object CommonAccountsApi {
endOfData()
}
} else {
val dataKey = new String(iter.key().drop(prefix.length), Charsets.UTF_8)
val dataKey = new String(iter.key().drop(prefix.length), StandardCharsets.UTF_8)
if (matches(dataKey)) {
nextDbEntry = Option(iter.value()).map { arr =>
Keys.data(addressId, dataKey).parse(arr).entry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ class RocksDBWriter(
}

private def batchCleanupAssetBalances(fromInclusive: Height, toExclusive: Height, rw: RW): Unit = {
val lastUpdateAt = mutable.AnyRefMap.empty[(AddressId, IssuedAsset), Height]
val lastUpdateAt = mutable.HashMap.empty[(AddressId, IssuedAsset), Height]

val updateAt = new ArrayBuffer[(AddressId, IssuedAsset, Height)]() // First height of update in this range
val updateAtKeys = new ArrayBuffer[Key[BalanceNode]]()
Expand Down Expand Up @@ -890,7 +890,7 @@ class RocksDBWriter(

private def batchCleanupAccountData(fromInclusive: Height, toExclusive: Height, rw: RW): Unit = {
val changedDataAddresses = mutable.Set.empty[AddressId]
val lastUpdateAt = mutable.AnyRefMap.empty[(AddressId, String), Height]
val lastUpdateAt = mutable.HashMap.empty[(AddressId, String), Height]

val updateAt = new ArrayBuffer[(AddressId, String, Height)]() // First height of update in this range
val updateAtKeys = new ArrayBuffer[Key[DataNode]]()
Expand Down
4 changes: 2 additions & 2 deletions node/src/main/scala/com/wavesplatform/database/package.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.wavesplatform

import com.google.common.base.Charsets.UTF_8
import com.google.common.collect.{Interners, Maps}
import com.google.common.io.ByteStreams.{newDataInput, newDataOutput}
import com.google.common.io.{ByteArrayDataInput, ByteArrayDataOutput}
Expand Down Expand Up @@ -32,6 +31,7 @@ import sun.nio.ch.Util
import supertagged.TaggedType

import java.nio.ByteBuffer
import java.nio.charset.StandardCharsets
import java.util.Map as JMap
import scala.annotation.tailrec
import scala.collection.mutable.ArrayBuffer
Expand Down Expand Up @@ -97,7 +97,7 @@ package object database {

while (i < data.length) {
val len = ((data(i) << 8) | (data(i + 1) & 0xff)).toShort // Optimization
s += new String(data, i + 2, len, UTF_8)
s += new String(data, i + 2, len, StandardCharsets.UTF_8)
i += (2 + len)
}
s.result()
Expand Down
12 changes: 6 additions & 6 deletions node/src/main/scala/com/wavesplatform/network/Handshake.scala
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.wavesplatform.network

import java.net.{InetAddress, InetSocketAddress}

import com.google.common.base.Charsets
import com.wavesplatform.utils.*
import io.netty.buffer.ByteBuf
import com.wavesplatform.utils._

import java.net.{InetAddress, InetSocketAddress}
import java.nio.charset.StandardCharsets

case class Handshake(
applicationName: String,
Expand Down Expand Up @@ -57,14 +57,14 @@ object Handshake {
if (appNameSize < 0 || appNameSize > Byte.MaxValue) {
throw new InvalidHandshakeException(s"An invalid application name's size: $appNameSize")
}
val appName = in.readSlice(appNameSize).toString(Charsets.UTF_8)
val appName = in.readSlice(appNameSize).toString(StandardCharsets.UTF_8)
val appVersion = (in.readInt(), in.readInt(), in.readInt())

val nodeNameSize = in.readByte()
if (nodeNameSize < 0 || nodeNameSize > Byte.MaxValue) {
throw new InvalidHandshakeException(s"An invalid node name's size: $nodeNameSize")
}
val nodeName = in.readSlice(nodeNameSize).toString(Charsets.UTF_8)
val nodeName = in.readSlice(nodeNameSize).toString(StandardCharsets.UTF_8)

val nonce = in.readLong()

Expand Down
6 changes: 3 additions & 3 deletions node/src/main/scala/com/wavesplatform/utils/package.scala
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.wavesplatform

import com.google.common.base.Charsets
import com.google.common.primitives.UnsignedBytes
import com.google.protobuf.ByteString
import com.wavesplatform.common.state.ByteStr
import com.wavesplatform.common.utils.{Base58, Base64}
import com.wavesplatform.lang.v1.compiler.Terms.*
import play.api.libs.json.*

import java.nio.charset.StandardCharsets
import java.security.SecureRandom
import scala.annotation.tailrec

Expand Down Expand Up @@ -80,7 +80,7 @@ package object utils {
}

implicit class StringBytes(val s: String) extends AnyVal {
def utf8Bytes: Array[Byte] = s.getBytes(Charsets.UTF_8)
def utf8Bytes: Array[Byte] = s.getBytes(StandardCharsets.UTF_8)
def toByteString: ByteString = ByteString.copyFromUtf8(s)
}

Expand All @@ -98,5 +98,5 @@ package object utils {
case FAIL(reason) => Json.obj("error" -> ApiError.ScriptExecutionError.Id, "error" -> reason)
}

implicit val byteStrOrdering: Ordering[ByteStr] = (x, y) => UnsignedBytes.lexicographicalComparator().compare(x.arr, y.arr)
implicit val byteStrOrdering: Ordering[ByteStr] = (x, y) => UnsignedBytes.lexicographicalComparator().compare(x.arr, y.arr)
}
Loading
Loading