Skip to content
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
10 changes: 5 additions & 5 deletions .github/workflows/check-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
lang-changed: ${{ steps.filter.outputs.lang == 'true' }}
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5.3.0
- uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5.5.0
with:
distribution: 'temurin'
java-version: '17'
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
matrix:
os: [macos-15-intel, macos-15, ubuntu-24.04, ubuntu-24.04-arm, windows-2022]
steps:
- uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5.3.0
- uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5.5.0
with:
distribution: 'temurin'
java-version: '17'
Expand All @@ -91,7 +91,7 @@ jobs:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
repository: ${{ matrix.repo }}
- uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5.3.0
- uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5.5.0
with:
distribution: 'temurin'
java-version: '17'
Expand All @@ -106,7 +106,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5.3.0
- uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5.5.0
with:
distribution: 'temurin'
java-version: '17'
Expand Down Expand Up @@ -141,7 +141,7 @@ jobs:
PR_NUMBER: ${{ github.event.number }}
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5.3.0
- uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5.5.0
with:
distribution: 'temurin'
java-version: '17'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/on-push-default-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5.3.0
- uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5.5.0
with:
distribution: 'temurin'
java-version: '17'
Expand All @@ -25,7 +25,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5.3.0
- uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5.5.0
with:
distribution: 'temurin'
java-version: '17'
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/on-release-published.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
- uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
Expand All @@ -42,7 +42,7 @@ jobs:
tags: |
type=ref,event=tag
type=raw,value=latest,enable=${{ github.event.release.prerelease == false }}
- uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5.4.0
- uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
platforms: linux/amd64,linux/arm64
context: ./docker/private
Expand All @@ -58,15 +58,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5.3.0
- uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5.5.0
with:
distribution: 'temurin'
java-version: '17'
cache: 'sbt'
- uses: sbt/setup-sbt@3afe9cf056c5d139bfc46579af1192d77a2f0821 # v1.4.0
- run: sbt --batch 'buildRIDERunnerForDocker'
- uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
- uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
Expand All @@ -78,7 +78,7 @@ jobs:
tags: |
type=match,pattern=v(.*),group=1
type=raw,value=latest,enable=${{ github.event.release.prerelease == false }}
- uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5.4.0
- uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: ./ride-runner/docker
push: ${{ github.event_name == 'release' }}
Expand All @@ -103,7 +103,7 @@ jobs:
run: |
echo "::error::Release version $RELEASE_VERSION does not match SBT version $SBT_VERSION"
exit 1
- uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5.3.0
- uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5.5.0
with:
distribution: 'temurin'
java-version: '17'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prepare-release-draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
id-token: write
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5.3.0
- uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5.5.0
with:
distribution: 'temurin'
java-version: '17'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-aptly-repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
echo "aptly_cachekey=aptly-$APTLY_VERSION" >> "$GITHUB_OUTPUT"
- name: Cache aptly
id: cache-aptly
uses: actions/cache@2c8a9bd7457de244a408f35966fab2fb45fda9c8 # v6.0.0
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ steps.cache-aptly-path.outputs.aptly_toolpath }}
key: ${{ steps.cache-aptly-path.outputs.aptly_cachekey }}
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/publish-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
ref: ${{ inputs.ref }}
- uses: regclient/actions/regctl-installer@4b4db1dcc7dad75ad67a788a380f75a20cc8a040 # v0.1.0
- uses: regclient/actions/regctl-installer@39bf30ced4be9d147faaabbde2682e9725fb8bd1 # v0.1.0
- uses: proudust/gh-describe@80412be8ce0e77d8afba6b340e34790bc772aa45 # v2.2.0
id: ghd
with:
Expand All @@ -64,7 +64,7 @@ jobs:
echo "base-image-digest=$(regctl manifest digest $BASE_IMAGE)" >> "$GITHUB_OUTPUT"
echo "node-version=$(echo ${{ steps.ghd.outputs.describe }} | cut -c 2-)" >> "$GITHUB_OUTPUT"
id: versions
- uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5.3.0
- uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5.5.0
with:
distribution: 'temurin'
java-version: '17'
Expand Down Expand Up @@ -107,12 +107,12 @@ jobs:
echo EOF
} >> "$GITHUB_OUTPUT"
id: annotations
- uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
- uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
- uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0
if: inputs.environment != ''
with:
username: ${{ secrets.DOCKERHUB_USER }}
Expand All @@ -127,7 +127,7 @@ jobs:
flavor: latest=${{ contains(inputs.docker-tags, 'latest') }}
tags: ${{ env.TAGS }}
annotations: ${{ steps.annotations.outputs.annotations }}
- uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
- uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
id: push
with:
context: ./docker
Expand Down Expand Up @@ -174,7 +174,7 @@ jobs:
echo ${{ inputs.docker-tags }} | tr ',' '\n' | sed -e 's/^/type=raw,value=/'
echo EOF
} >> "$GITHUB_ENV"
- uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
- uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand All @@ -193,7 +193,7 @@ jobs:
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.version=${{ needs.publish.outputs.node-version }}
org.opencontainers.image.base.digest=${{ needs.publish.outputs.digest }}
- uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5.4.0
- uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
platforms: linux/amd64,linux/arm64
context: ./docker/private
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-to-npmjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: proudust/gh-describe@80412be8ce0e77d8afba6b340e34790bc772aa45 # v2.2.0
id: ghd
- uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5.3.0
- uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5.5.0
with:
distribution: 'temurin'
java-version: '17'
Expand Down
2 changes: 1 addition & 1 deletion benchmark/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Test / classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.Flat
libraryDependencies ++= Seq(
"org.scodec" %% "scodec-core" % "2.3.3",
"org.eclipse.collections" % "eclipse-collections" % "13.0.0",
"commons-codec" % "commons-codec" % "1.22.0",
"commons-codec" % "commons-codec" % "1.22.1",
"org.apache.commons" % "commons-lang3" % "3.20.0"
) ++ Dependencies.logDeps

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ package object grpc {
sendNextItem()

p.future
} else Future.failed(new IllegalStateException(s"An element ${nextItem()} is pending"))
} else Future.failed(new IllegalStateException(s"An element ${nextItem.get()} is pending"))
},
err => cso.onError(err),
{ () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import com.wavesplatform.lang.v1.parser.BinaryOperation.*
import com.wavesplatform.lang.v1.{BaseGlobal, CTX, FunctionHeader, compiler}

import java.nio.charset.StandardCharsets.UTF_8
import java.nio.charset.{MalformedInputException, StandardCharsets}
import java.nio.charset.{CharsetDecoder, MalformedInputException, StandardCharsets}
import java.nio.{BufferUnderflowException, ByteBuffer}
import scala.annotation.tailrec
import scala.collection.mutable.ArrayBuffer
Expand Down Expand Up @@ -947,7 +947,9 @@ object PureContext {
notImplemented[Id, EVALUATED]("dropRight(xs: String, number: Int)", xs)
}

val UTF8Decoder = UTF_8.newDecoder
val UTF8Decoder = new ThreadLocal[CharsetDecoder] {
override def initialValue(): CharsetDecoder = UTF_8.newDecoder()
}

def toUtf8String(reduceLimit: Boolean): BaseFunction[NoContext] =
NativeFunction(
Expand All @@ -959,7 +961,7 @@ object PureContext {
) {
case CONST_BYTESTR(u) :: Nil =>
Try(ByteBuffer.wrap(u.arr))
.map(UTF8Decoder.decode)
.map(UTF8Decoder.get().decode)
.toEither
.map(_.toString)
.flatMap(CONST_STRING(_, reduceLimit))
Expand Down
20 changes: 11 additions & 9 deletions node/src/main/scala/com/wavesplatform/Application.scala
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ class Application(val actorSystem: ActorSystem, val settings: WavesSettings, con
forceStopApplication(FatalDBError)
}

private def reportErrorAndBlacklist(errorMessage: String, source: Channel)(maybeThrowable: Option[Throwable]): Task[Unit] = {
maybeThrowable.foreach { t =>
peerDatabase.blacklistAndClose(source, errorMessage)
log.warn(errorMessage, t)
}
Task.now(())
}

private val appenderScheduler = singleThread("appender", stopOnAppendError)

private val extensionLoaderScheduler = singleThread("rx-extension-loader", reporter = log.error("Error in Extension Loader", _))
Expand Down Expand Up @@ -344,12 +352,7 @@ class Application(val actorSystem: ActorSystem, val settings: WavesSettings, con
syncWithChannelClosed,
extensionLoaderScheduler,
timeoutSubject
) { case (c, b) =>
processFork(c, b).doOnFinish {
case None => Task.now(())
case Some(e) => Task(stopOnAppendError.reportFailure(e))
}
}
) { case (c, b) => processFork(c, b).doOnFinish(reportErrorAndBlacklist("Exception caught while processing extension", c)) }

TransactionSynchronizer(
settings.synchronizationSettings.utxSynchronizer,
Expand All @@ -360,11 +363,10 @@ class Application(val actorSystem: ActorSystem, val settings: WavesSettings, con

Observable(
microblockDataWithSnapshot
.mapEval(processMicroBlock.tupled),
.mapEval { case (c, md, sd) => processMicroBlock(c, md, sd).doOnFinish(reportErrorAndBlacklist("Error appending microblock", c)) },
newBlocksWithSnapshot
.mapEval(processBlock.tupled)
.mapEval { case (c, b, s) => processBlock(c, b, s).doOnFinish(reportErrorAndBlacklist("Error appending blocks", c)) }
).mergeMap(identity)
.onErrorHandle(stopOnAppendError.reportFailure)
.subscribe()

// API start
Expand Down
43 changes: 34 additions & 9 deletions node/src/main/scala/com/wavesplatform/database/RDB.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ object RDB extends StrictLogging {
final class TxSnapshotHandle private[RDB] (val handle: ColumnFamilyHandle)
final class ApiHandle private[RDB] (val handle: ColumnFamilyHandle)

val TxMetaCF = "tx-meta"
val TxCF = "tx"
val TxSnapshotCF = "tx-snapshot"
val ApiCF = "api"

/** Column families that only contain data derived from the blockchain and can be truncated without losing the state */
val NonEssentialColumnFamilies: Seq[String] = Seq(TxSnapshotCF, ApiCF)

case class OptionsWithResources[A](options: A, resources: Seq[RocksObject])

def open(settings: DBSettings): RDB = {
Expand Down Expand Up @@ -63,26 +71,26 @@ object RDB extends StrictLogging {
.setCfPaths(Seq(new DbPath(new File(dbDir, "default").toPath, 0L)).asJava)
),
new ColumnFamilyDescriptor(
"tx-meta".utf8Bytes,
TxMetaCF.utf8Bytes,
txMetaCfOptions.options
.optimizeForPointLookup(16 << 20) // Iterators might not work with this option
.setDisableAutoCompactions(true)
.setCfPaths(Seq(new DbPath(new File(dbDir, "tx-meta").toPath, 0L)).asJava)
.setCfPaths(Seq(new DbPath(new File(dbDir, TxMetaCF).toPath, 0L)).asJava)
),
new ColumnFamilyDescriptor(
"tx".utf8Bytes,
TxCF.utf8Bytes,
txCfOptions.options
.setCfPaths(Seq(new DbPath(new File(dbDir, "tx").toPath, 0L)).asJava)
.setCfPaths(Seq(new DbPath(new File(dbDir, TxCF).toPath, 0L)).asJava)
),
new ColumnFamilyDescriptor(
"tx-snapshot".utf8Bytes,
TxSnapshotCF.utf8Bytes,
txSnapshotCfOptions.options
.setCfPaths(Seq(new DbPath(new File(dbDir, "tx-snapshot").toPath, 0L)).asJava)
.setCfPaths(Seq(new DbPath(new File(dbDir, TxSnapshotCF).toPath, 0L)).asJava)
),
new ColumnFamilyDescriptor(
"api".utf8Bytes,
ApiCF.utf8Bytes,
apiCfOptions.options
.setCfPaths(Seq(new DbPath(new File(dbDir, "api").toPath, 0L)).asJava)
.setCfPaths(Seq(new DbPath(new File(dbDir, ApiCF).toPath, 0L)).asJava)
)
).asJava,
handles
Expand All @@ -94,10 +102,27 @@ object RDB extends StrictLogging {
new TxHandle(handles.get(2)),
new TxSnapshotHandle(handles.get(3)),
new ApiHandle(handles.get(4)),
dbOptions.resources ++ defaultCfOptions.resources ++ txMetaCfOptions.resources ++ txCfOptions.resources ++ txSnapshotCfOptions.resources
dbOptions.resources ++ defaultCfOptions.resources ++ txMetaCfOptions.resources ++ txCfOptions.resources ++
txSnapshotCfOptions.resources ++ apiCfOptions.resources
)
}

/** Removes all the data from a non-essential column family by dropping it. It is re-created on the next [[open]], because the DB is opened
* with `createMissingColumnFamilies`.
*/
def truncateColumnFamily(settings: DBSettings, cfName: String): Unit = {
val handleOf: RDB => ColumnFamilyHandle = cfName match {
case TxSnapshotCF => _.txSnapshotHandle.handle
case ApiCF => _.apiHandle.handle
case _ => throw new IllegalArgumentException(s"$cfName is not one of ${NonEssentialColumnFamilies.mkString(", ")}")
}

Using.resource(open(settings)) { rdb =>
logger.info(s"Truncating $cfName")
rdb.db.dropColumnFamily(handleOf(rdb))
}
}

private def newColumnFamilyOptions(
bitsPerKey: Double,
blockSize: Long,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ abstract class InetSocketAddressSeqSpec[A <: AnyRef: ClassTag] extends MessageSp

override val messageCode: Message.MessageCode = 2: Byte

override val maxLength: Int = DataLength + 1000 * (AddressLength + PortLength)
override val maxLength: Int = DataLength + InetSocketAddressSeqSpec.MaxAddressCount * (AddressLength + PortLength)

protected def unwrap(v: A): Seq[InetSocketAddress]
protected def wrap(addresses: Seq[InetSocketAddress]): A
Expand Down Expand Up @@ -82,6 +82,10 @@ abstract class InetSocketAddressSeqSpec[A <: AnyRef: ClassTag] extends MessageSp
}
}

object InetSocketAddressSeqSpec {
val MaxAddressCount: Int = 1000
}

object PeersSpec extends InetSocketAddressSeqSpec[KnownPeers] {
override protected def unwrap(v: KnownPeers): Seq[InetSocketAddress] = v.peers

Expand Down
Loading
Loading