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 #3967

Merged
merged 19 commits into from
Oct 2, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/check-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ jobs:
SONATYPE_USERNAME: ${{ secrets.OSSRH_USERNAME }}
PGP_PASSPHRASE: ${{ secrets.OSSRH_GPG_PASSPHRASE }}
run: |
sbt_version=$(cut -d\" -f2 version.sbt)
version=$(echo ${{ github.base_ref }} | awk -F '[-\.]' '{print $2"."$3}')
pr_number=${{ github.event.number }}
sbt -Dproject.version=$sbt_version-$pr_number-SNAPSHOT --mem 4096 --batch publishSigned
sbt -Dproject.version=$version-$pr_number-SNAPSHOT --mem 4096 --batch publishSigned
- name: Save debug data
uses: actions/upload-artifact@v4
if: always()
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/push-default-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish Artifacts

on:
push:
branches:
- 'version-1.*.*'

jobs:
update-graph:
name: Update Dependency Graph
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: scalacenter/sbt-dependency-submission@v3
publish-snapshot:
name: Publish Snapshots to Sonatype
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
cache: 'sbt'
gpg-private-key: ${{ secrets.OSSRH_GPG_KEY }}
gpg-passphrase: ${{ secrets.OSSRH_GPG_PASSPHRASE }}
- name: Publish snapshots
env:
SONATYPE_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.OSSRH_USERNAME }}
PGP_PASSPHRASE: ${{ secrets.OSSRH_GPG_PASSPHRASE }}
run: |
version=$(echo ${{ github.base_ref }} | awk -F '[-\.]' '{print $2"."$3}')-SNAPSHOT
sbt -Dproject.version=$version --mem 4096 --batch publishSigned
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ enablePlugins(GitVersioning)
git.uncommittedSignifier := Some("DIRTY")
git.useGitDescribe := true
ThisBuild / git.useGitDescribe := true
ThisBuild / PB.protocVersion := "3.25.1" // https://protobuf.dev/support/version-support/#java
ThisBuild / PB.protocVersion := "3.25.5" // https://protobuf.dev/support/version-support/#java

lazy val lang =
crossProject(JSPlatform, JVMPlatform)
Expand Down Expand Up @@ -145,7 +145,7 @@ lazy val `waves-node` = (project in file("."))

inScope(Global)(
Seq(
scalaVersion := "2.13.14",
scalaVersion := "2.13.15",
organization := "com.wavesplatform",
organizationName := "Waves Platform",
organizationHomepage := Some(url("https://wavesplatform.com")),
Expand Down
12 changes: 1 addition & 11 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
FROM eclipse-temurin:11-jre-jammy
FROM eclipse-temurin:11-jre-noble

ENV WAVES_LOG_LEVEL=INFO
ENV WAVES_HEAP_SIZE=2g
ENV WAVES_NETWORK=mainnet

ENV YOURKIT_VERSION=2023.5

SHELL ["/bin/bash", "-c"]

# Additional dependencies
RUN apt-get update && apt-get install -y wget unzip gosu || exit 1; \
export YOURKIT_ARCHIVE="YourKit-JavaProfiler-$YOURKIT_VERSION-docker.zip"; \
wget --quiet "https://www.yourkit.com/download/docker/$YOURKIT_ARCHIVE" -P /tmp/ && unzip /tmp/$YOURKIT_ARCHIVE -d /usr/local || exit 1; \
# Clean
apt-get remove -y wget unzip && apt-get autoremove -y && apt-get autoclean && rm -rf /var/lib/apt/lists/*

# Node files
ENV WVDATA=/var/lib/waves
ENV WVLOG=/var/log/waves
ENV WAVES_INSTALL_PATH=/usr/share/waves
ENV WAVES_CONFIG=/etc/waves/waves.conf
COPY target /tmp/
COPY waves.conf.template $WAVES_CONFIG

# Setup node
COPY entrypoint.sh $WAVES_INSTALL_PATH/bin/entrypoint.sh
Expand Down
40 changes: 20 additions & 20 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,39 +28,39 @@ It is highly recommended to read more about [Waves Node configuration](https://d

## Running Docker image



### Configuration options

1. The image supports Waves Node config customization. To change a config field use corresponding JVM options. JVM options can be sent to JVM using `JAVA_OPTS` environment variable. Please refer to ([complete configuration file](https://github.com/wavesplatform/Waves/blob/master/node/src/main/resources/application.conf)) to get the full path of the configuration item you want to change.

```
docker run -v /docker/waves/waves-data:/var/lib/waves -v /docker/waves/waves-config:/etc/waves -p 6869:6869 -p 6862:6862 -e JAVA_OPTS="-Dwaves.rest-api.enable=yes -Dwaves.wallet.password=myWalletSuperPassword" -ti wavesplatform/wavesnode
```
```
docker run -v /docker/waves/waves-data:/var/lib/waves -v /docker/waves/waves-config:/etc/waves -p 6869:6869 -p 6862:6862 -e JAVA_OPTS="-Dwaves.rest-api.enable=yes -Dwaves.wallet.password=myWalletSuperPassword" -ti wavesplatform/wavesnode
```

2. Waves Node is looking for a config in the directory `/etc/waves/waves.conf` which can be mounted using Docker volumes. During image build, a default configuration will be copied to this directory. While running container if the value of `WAVES_NETWORK` is not `mainnet`, `testnet` or `stagenet`, default configuration won't be enough for correct node working. This is a scenario of using `CUSTOM` network - correct configuration must be provided when running container. If you use `CUSTOM` network and `/etc/waves/waves.conf` is NOT found Waves Node container will exit.
2. Waves Node is looking for a config in the directory `/etc/waves/waves.conf` which can be mounted using Docker volumes. For custom networks, correct configuration file must be provided when running container. If you use `CUSTOM` network and `/etc/waves/waves.conf` is NOT found Waves Node container will exit.

3. By default, `/etc/waves/waves.conf` config includes `/etc/waves/local.conf`. Custom `/etc/waves/local.conf` can be used to override default config entries. Custom `/etc/waves/waves.conf` can be used to override or the whole configuration. For additional information about Docker volumes mapping please refer to `Managing data` item.
3. You can use custom config to override or the whole configuration. For additional information about Docker volumes mapping please refer to `Managing data` item.

4. You can override the default executable by using the following syntax:
```
docker run -it wavesplatform/wavesnode [command] [args]
```
```
docker run -it wavesplatform/wavesnode [command] [args]
```

### Environment variables

**You can run container with predefined environment variables:**

| Env variable | Description |
|-----------------------------------|--------------|
| `WAVES_WALLET_SEED` | Base58 encoded seed. Overrides `-Dwaves.wallet.seed` JVM config option. |
| `WAVES_WALLET_PASSWORD` | Password for the wallet file. Overrides `-Dwaves.wallet.password` JVM config option. |
| `WAVES_LOG_LEVEL` | Node logging level. Available values: `OFF`, `ERROR`, `WARN`, `INFO`, `DEBUG`, `TRACE`. More details about logging are available [here](https://docs.waves.tech/en/waves-node/logging-configuration).|
| `WAVES_HEAP_SIZE` | Default Java Heap Size limit in -X Command-line Options notation (`-Xms=[your value]`). More details [here](https://docs.oracle.com/cd/E13150_01/jrockit_jvm/jrockit/jrdocs/refman/optionX.html). |
|`WAVES_NETWORK` | Waves Blockchain network. Available values are `mainnet`, `testnet`, `stagenet`.|
|`JAVA_OPTS` | Additional Waves Node JVM configuration options. |
The following environment variables can be passed to the container:

**Note: All variables are optional.**
| Env variable | Description |
|-------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `WAVES_WALLET_SEED` | Base58 encoded seed, sets `-Dwaves.wallet.seed` system property. |
| `WAVES_WALLET_PASSWORD` | Password for the wallet file, sets `-Dwaves.wallet.password` system property. |
| `WAVES_LOG_LEVEL` | Node stdout logging level. Available values: `OFF`, `ERROR`, `WARN`, `INFO`, `DEBUG`, `TRACE`. More details about logging are available [here](https://docs.waves.tech/en/waves-node/logging-configuration). |
| `WAVES_HEAP_SIZE` | Default Java Heap Size limit in -X Command-line Options notation (`-Xmx=[your value]`). More details [here](https://docs.oracle.com/cd/E13150_01/jrockit_jvm/jrockit/jrdocs/refman/optionX.html). |
| `WAVES_NETWORK` | Waves Blockchain network. Available values are `mainnet`, `testnet`, `stagenet`. |
| `JAVA_OPTS` | Additional Waves Node JVM configuration options. |

**Note: Environment variables override values in the configuration file.**
All environment variables are optional, however you need to specify at least the desired network and wallet password (via environment variables, additional system properties defined in the `JAVA_OPTS` environment variable, or in the config file).

### Managing data
We recommend to store the blockchain state as well as Waves configuration on the host side. As such, consider using Docker volumes mapping to map host directories inside the container:
Expand Down
45 changes: 23 additions & 22 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
#!/bin/bash
shopt -s nullglob

logEcho() {
echo $1 | gosu waves tee -a /var/log/waves/waves.log
}
[ -n "${YOURKIT_OPTS}" ] && JAVA_OPTS="$JAVA_OPTS -agentpath:/usr/local/YourKit-JavaProfiler-$YOURKIT_VERSION/bin/linux-x86-64/libyjpagent.so=$YOURKIT_OPTS"
JAVA_OPTS="${JAVA_OPTS} -Dwaves.defaults.blockchain.type=$WAVES_NETWORK -Dwaves.defaults.directory=$WVDATA"

logEcho "Node is starting..."
logEcho "WAVES_HEAP_SIZE='${WAVES_HEAP_SIZE}'"
logEcho "WAVES_LOG_LEVEL='${WAVES_LOG_LEVEL}'"
logEcho "JAVA_OPTS='${JAVA_OPTS}'"

JAVA_OPTS="-Dlogback.stdout.level=${WAVES_LOG_LEVEL}
-XX:+ExitOnOutOfMemoryError
JAVA_OPTS="-XX:+ExitOnOutOfMemoryError
-Xmx${WAVES_HEAP_SIZE}
-Dlogback.file.directory=$WVLOG
-Dconfig.override_with_env_vars=true
--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED
-Dlogback.stdout.level=${WAVES_LOG_LEVEL}
-Dlogback.file.directory=${WVLOG}
-Dwaves.config.directory=/etc/waves
-Dwaves.defaults.blockchain.type=${WAVES_NETWORK}
-Dwaves.directory=${WVDATA}
-Dwaves.rest-api.bind-address=0.0.0.0
${JAVA_OPTS}"

if [ $# -eq 0 ]
then
ARGS="$WAVES_CONFIG"
else
ARGS=$@
echo "JAVA_OPTS=${JAVA_OPTS}" | tee -a ${WVLOG}/waves.log

if [ -n "$WAVES_WALLET_SEED" ] ; then
JAVA_OPTS="-Dwaves.wallet.seed=${WAVES_WALLET_SEED} ${JAVA_OPTS}"
fi

if [ -n "$WAVES_WALLET_PASSWORD" ] ; then
JAVA_OPTS="-Dwaves.wallet.password=${WAVES_WALLET_PASSWORD} ${JAVA_OPTS}"
fi

if [ $# -eq 0 ] && [ -f /etc/waves/waves.conf ] ; then
ARGS="/etc/waves/waves.conf"
else
ARGS=$@
fi

exec java $JAVA_OPTS -cp "${WAVES_INSTALL_PATH}/lib/plugins/*:$WAVES_INSTALL_PATH/lib/*" com.wavesplatform.Application $ARGS
exec java $JAVA_OPTS -cp "$WAVES_INSTALL_PATH/lib/plugins/*:$WAVES_INSTALL_PATH/lib/*" com.wavesplatform.Application $ARGS
10 changes: 0 additions & 10 deletions docker/waves.conf.template

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ class Parser(stdLibVersion: StdLibVersion)(implicit offset: LibrariesOffset) {
def unusedText[A: P] = comment ~ directive ~ comment

def escapedUnicodeSymbolP[A: P]: P[(Int, String, Int)] = P(Index ~~ (NoCut(unicodeSymbolP) | specialSymbols).! ~~ Index)
def escapedUnicodeOrEndOfString[A: P]: P[Any] = escapedUnicodeSymbolP[A] | notEndOfString
def stringP[A: P]: P[EXPR] =
P(Index ~~ "\"" ~/ Pass ~~ (escapedUnicodeSymbolP | notEndOfString).!.repX ~~ "\"" ~~ Index)
P(Index ~~ "\"" ~/ Pass ~~ (escapedUnicodeOrEndOfString).!.repX ~~ "\"" ~~ Index)
.map { case (start, xs, end) =>
var errors = Vector.empty[String]
val consumedString = new StringBuilder
Expand Down Expand Up @@ -255,9 +256,9 @@ class Parser(stdLibVersion: StdLibVersion)(implicit offset: LibrariesOffset) {
def funcBody = singleBaseExpr
def correctFunc = Index ~~ funcKWAndName ~ comment ~/ args(min = 0) ~ ("=" ~ funcBody | "=" ~/ Fail.opaque("function body")) ~~ Index
def noKeyword = {
def noArgs = "(" ~ comment ~ ")" ~ comment
def validName = NoCut(funcName).filter(_.isInstanceOf[VALID[?]])
def argsOrEqual = (NoCut(args(min = 1)) ~ "=".?) | (noArgs ~ "=" ~~ !"=")
def noArgs = "(" ~ comment ~ ")" ~ comment
def validName = NoCut(funcName).filter(_.isInstanceOf[VALID[?]])
def argsOrEqual: P[Any] = (NoCut(args(min = 1)) ~ "=".?) | (noArgs ~ "=" ~~ !"=")
(validName ~ comment ~ argsOrEqual ~/ funcBody.? ~~ Fail)
.asInstanceOf[P[Nothing]]
.opaque(""""func" keyword""")
Expand Down
6 changes: 3 additions & 3 deletions node-it/src/test/scala/com/wavesplatform/it/Docker.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import org.asynchttpclient.Dsl.*
import java.io.{FileOutputStream, IOException}
import java.net.{InetAddress, InetSocketAddress, URL}
import java.nio.file.{Files, Path, Paths}
import java.time.LocalDateTime
import java.time.{LocalDateTime, Duration as JDuration}
import java.time.format.DateTimeFormatter
import java.util.Collections.*
import java.util.concurrent.ConcurrentHashMap
Expand Down Expand Up @@ -58,9 +58,9 @@ class Docker(
.setMaxConnections(18)
.setMaxConnectionsPerHost(3)
.setMaxRequestRetry(1)
.setReadTimeout(10000)
.setReadTimeout(JDuration.ofSeconds(10))
.setKeepAlive(false)
.setRequestTimeout(10000)
.setRequestTimeout(JDuration.ofSeconds(10))
)

private val client = DefaultDockerClient.fromEnv().build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import java.io.IOException
import java.net.{InetSocketAddress, URLEncoder}
import java.util.concurrent.TimeoutException
import java.util.{NoSuchElementException, UUID}
import java.time.{Duration as JDuration}
import com.google.protobuf.ByteString
import com.wavesplatform.account.{AddressOrAlias, AddressScheme, KeyPair, SeedKeyPair}
import com.wavesplatform.api.http.DebugMessage.*
Expand Down Expand Up @@ -183,8 +184,8 @@ object AsyncHttpApi extends Assertions {

def request =
_get(s"${n.nodeApiEndpoint}/blocks/height?${System.currentTimeMillis()}")
.setReadTimeout(timeout)
.setRequestTimeout(timeout)
.setReadTimeout(JDuration.ofMillis(timeout))
.setRequestTimeout(JDuration.ofMillis(timeout))
.build()

def send(): Future[Option[Response]] =
Expand Down
2 changes: 1 addition & 1 deletion node/src/main/scala/com/wavesplatform/Application.scala
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ object Application extends ScorexLogging {
.map(_.toUpperCase)
.getOrElse("TESTNET")

log.warn(s"Config file not defined, default $currentBlockchainType config will be used")
log.info(s"Config file not specified, default $currentBlockchainType config will be used")
case Failure(exception) =>
log.error(s"Couldn't read ${external.get.toPath.toAbsolutePath}", exception)
forceStopApplication(Misconfiguration)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ object AddressTransactions {
types: Set[Transaction.Type]
) extends AbstractIterator[Seq[(TxMeta, Transaction, Option[TxNum])]] {
private val seqNr = db.get(Keys.addressTransactionSeqNr(addressId, apiHandle))
db.withSafePrefixIterator(_.seekForPrev(Keys.addressTransactionHN(addressId, seqNr, apiHandle).keyBytes))()
db.withSafePrefixIterator(_.seekForPrev(Keys.addressTransactionHN(addressId, seqNr, apiHandle).keyBytes))(())

final override def computeNext(): Seq[(TxMeta, Transaction, Option[TxNum])] = db.withSafePrefixIterator { dbIterator =>
val keysBuffer = new ArrayBuffer[Key[Option[(TxMeta, Transaction)]]]()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ object CommonAccountsApi {

private val length: Int = entriesFromDiff.length

db.withSafePrefixIterator(_.seek(prefix))()
db.withSafePrefixIterator(_.seek(prefix))(())

private var nextIndex = 0
private var nextDbEntry: Option[DataEntry[?]] = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import com.wavesplatform.state.LeaseDetails
private class LeaseByAddressIterator(resource: DBResource, apiHandle: RDB.ApiHandle, addressId: AddressId)
extends AbstractIterator[Seq[(ByteStr, LeaseDetails)]] {
private val seqNr = resource.get(Keys.addressLeaseSeqNr(addressId, apiHandle))
resource.withSafePrefixIterator(_.seekForPrev(Keys.addressLeaseSeq(addressId, seqNr, apiHandle).keyBytes))()
resource.withSafePrefixIterator(_.seekForPrev(Keys.addressLeaseSeq(addressId, seqNr, apiHandle).keyBytes))(())

final override def computeNext(): Seq[(ByteStr, LeaseDetails)] =
resource.withSafePrefixIterator { iterator =>
Expand Down
Loading