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
2 changes: 1 addition & 1 deletion .github/workflows/check-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:

local-network:
name: Run Local Network tests
timeout-minutes: 10
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
53 changes: 38 additions & 15 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import com.github.sbt.git.SbtGit.GitKeys.gitCurrentBranch

enablePlugins(UniversalDeployPlugin, GitVersioning, sbtdocker.DockerPlugin, VersionObject)
import scala.sys.process.{Process, ProcessLogger}

enablePlugins(UniversalDeployPlugin, GitVersioning, VersionObject)

git.useGitDescribe := true
git.baseVersion := "1.3.0"
git.baseVersion := "1.4.0"
git.uncommittedSignifier := Some("DIRTY")

inScope(Global)(
Expand Down Expand Up @@ -32,16 +34,32 @@ inScope(Global)(
name := "consensus-client"
maintainer := "Units Network Team"

// These overrides are needed so that there are no different versions of the same component on the classpath when the extension is installed
dependencyOverrides ++= Seq(
"org.playframework" %% "play-json" % "3.0.6",
"com.squareup.okhttp3" % "okhttp" % "4.12.0",
"com.squareup.okhttp3" % "logging-interceptor" % "4.12.0",
"com.squareup.okio" % "okio" % "3.6.0",
"com.squareup.okio" % "okio-jvm" % "3.16.4",
"org.reactivestreams" % "reactive-streams" % "1.0.4",
"org.jetbrains.kotlin" % "kotlin-stdlib" % "2.2.20",
"org.jetbrains.kotlin" % "kotlin-stdlib-jdk7" % "1.8.21",
"org.jetbrains.kotlin" % "kotlin-stdlib-jdk8" % "1.8.21"
)

libraryDependencies ++= {
val node = "1.5.12"
val node = "1.6.1"
val sttpVersion = "3.11.0"
Seq(
"com.wavesplatform" % "node-testkit" % node % Test,
"com.wavesplatform" % "node" % node % Provided,
"com.softwaremill.sttp.client3" %% "core" % sttpVersion,
"com.softwaremill.sttp.client3" %% "play-json" % sttpVersion,
"com.github.jwt-scala" %% "jwt-play-json" % "11.0.3",
"org.web3j" % "core" % "4.9.8"
("org.web3j" % "core" % "4.9.8").excludeAll(
ExclusionRule("org.slf4j", "slf4j-api"),
ExclusionRule("org.bouncycastle", "bcprov-jdk15on")
)
)
}

Expand Down Expand Up @@ -95,18 +113,23 @@ buildTarballsForDocker := {
)
}

inTask(docker)(
Seq(
imageNames := Seq(
ImageName(s"consensus-client:${gitCurrentBranch.value}"), // Integration tests
ImageName("consensus-client:local") // local-network
),
dockerfile := NativeDockerfile(baseDirectory.value / "docker" / "Dockerfile"),
buildOptions := BuildOptions(
pullBaseImage = BuildOptions.Pull.IfMissing
)
val docker = taskKey[Unit]("Build docker image for integration tests")
docker := {
val log = streams.value.log

val cwd = baseDirectory.value / "docker"

val cmd = Seq("docker", "build", "-t", "consensus-client:local", "-t", s"consensus-client:${gitCurrentBranch.value}", ".")
log.info(s"Running `${cmd.mkString(" ")}` from $cwd")

val processLogger = ProcessLogger(
(out: String) => log.info(out),
(err: String) => log.info(err) // Redirect STDERR to info
)
)

val exit = Process(cmd, cwd).!(processLogger)
if (exit != 0) sys.error(s"Docker build failed with exit code $exit")
}

docker := docker.dependsOn(LocalRootProject / buildTarballsForDocker).value

Expand Down
2 changes: 1 addition & 1 deletion consensus-client-it/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import scala.util.control.NonFatal
description := "Consensus client integration tests"

libraryDependencies ++= Seq(
"org.testcontainers" % "testcontainers" % "2.0.1",
"org.testcontainers" % "testcontainers" % "2.0.3",
"org.web3j" % "core" % "4.9.8"
).map(_ % Test)

Expand Down
6 changes: 3 additions & 3 deletions local-network/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ You have to build consensus client. Run [./consensus_client-image-build.sh](./co

- Run `./all-images-build.sh` after pulling the repository, so docker compose will pull new external images and rebuild
the `deploy` image.
- Available docker compose contexts:
- Available docker compose profiles:
- BlockScout services: `bs`
- Tests in the end `tests`
- Run [./restart.sh](./restart.sh)
- With selected contexts, for example, `COMPOSE_PROFILES=bs,tests ./restart.sh`
- Or without any context: `./restart.sh`
- With selected profiles, for example, `COMPOSE_PROFILES=bs,tests ./restart.sh`
- Or without any profile: `./restart.sh`

To retry failed:

Expand Down
2 changes: 1 addition & 1 deletion local-network/delete.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ shopt -s nullglob
DIR="$(cd "$(dirname "$0")" && pwd)"
cd "${DIR}" || exit

COMPOSE_PROFILES=bs,tests BS=enabled docker compose down
COMPOSE_PROFILES='*' BS=enabled docker compose down
rm -rf data || true
rm -rf logs || true

Expand Down
8 changes: 8 additions & 0 deletions local-network/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ include:
- ./configs/blockscout/blockscout.yml
services:
ec-1:
profiles: [ nodes ]
container_name: ec-1
extends:
file: ../docker/services/op-geth.yml
Expand All @@ -23,6 +24,7 @@ services:

# ec-2:
# container_name: ec-2
# profiles: [ nodes ]
# extends:
# file: ../docker/services/op-geth.yml
# service: op-geth
Expand All @@ -43,6 +45,7 @@ services:
# Make sure, you have enough RAM to run additional nodes
# ec-3:
# container_name: ec-3
# profiles: [ nodes ]
# extends:
# file: ../docker/services/op-geth.yml
# service: op-geth
Expand All @@ -62,6 +65,7 @@ services:

# ec-4:
# container_name: ec-4
# profiles: [ nodes ]
# extends:
# file: ../docker/services/op-geth.yml
# service: op-geth
Expand All @@ -81,6 +85,7 @@ services:

waves-node-1:
container_name: waves-node-1
profiles: [ nodes ]
image: ${WAVES_NODE_IMAGE_1:-${WAVES_NODE_IMAGE:-consensus-client:local}}
ports:
- "127.0.0.1:16869:6869"
Expand All @@ -101,6 +106,7 @@ services:

# Uncomment corresponding cl_miner in local/network.py if you want this node to mine
# waves-node-2:
# profiles: [ nodes ]
# container_name: waves-node-2
# image: ${WAVES_NODE_IMAGE_2:-${WAVES_NODE_IMAGE:-consensus-client:local}}
# ports:
Expand All @@ -120,6 +126,7 @@ services:
# pull_policy: never # builds locally

# waves-node-3:
# profiles: [ nodes ]
# container_name: waves-node-3
# image: ${WAVES_NODE_IMAGE_3:-${WAVES_NODE_IMAGE:-consensus-client:local}}
# ports:
Expand All @@ -140,6 +147,7 @@ services:
# pull_policy: never # builds locally

# waves-node-4:
# profiles: [ nodes ]
# container_name: waves-node-4
# image: ${WAVES_NODE_IMAGE_4:-${WAVES_NODE_IMAGE:-consensus-client:local}}
# ports:
Expand Down
6 changes: 3 additions & 3 deletions local-network/restart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ else
./delete.sh
fi

export COMPOSE_PROFILES="${COMPOSE_PROFILES:-}"
COMPOSE_PROFILES="${COMPOSE_PROFILES:-}"
echo "Compose profiles are: ${COMPOSE_PROFILES}"

docker compose up -d
docker compose logs deploy tests -f
docker compose --profile nodes `[[ "${COMPOSE_PROFILES}" == *bs* ]] && echo --profile bs` up -d
docker compose --profile nodes up deploy `[[ "${COMPOSE_PROFILES}" == *tests* ]] && echo tests`
2 changes: 1 addition & 1 deletion local-network/stop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
DIR="$(cd "$(dirname "$0")" && pwd)"
cd "${DIR}" || exit

COMPOSE_PROFILES=bs,tests docker compose stop
COMPOSE_PROFILES='*' docker compose stop
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.11.2
sbt.version=1.12.3
1 change: 0 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@ libraryDependencies ++= Seq(
Seq(
"com.github.sbt" % "sbt-native-packager" % "1.10.0",
"com.github.sbt" % "sbt-ci-release" % "1.5.12",
"se.marcuslonnberg" % "sbt-docker" % "1.10.0",
"org.scalameta" % "sbt-scalafmt" % "2.5.4"
).map(addSbtPlugin)
2 changes: 1 addition & 1 deletion src/test/scala/units/C2ETransfersTestSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class C2ETransfersTestSuite extends BaseTestSuite {
"0x" -> "Invalid Ethereum address",
"000000000000000000000000000000000000000003" -> "Invalid Ethereum address",
"0x00000000000000000000000000000000000001" -> "Invalid Ethereum address",
"QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ" -> "Unrecognized character: q"
"QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ" -> "Unrecognized character: Q"
)
) { case (address, message) =>
transferFuncTest(address) should produce(message)
Expand Down
3 changes: 2 additions & 1 deletion src/test/scala/units/ExtensionDomain.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package units

import cats.syntax.either.*
import com.wavesplatform.account.{Address, KeyPair, PublicKey, SeedKeyPair}
import com.wavesplatform.api.common.{CommonAccountsApi, CommonAssetsApi, CommonBlocksApi, CommonTransactionsApi}
import com.wavesplatform.api.common.{CommonAccountsApi, CommonAssetsApi, CommonBlocksApi, CommonGeneratorsApi, CommonTransactionsApi}
import com.wavesplatform.api.http.requests.InvokeScriptRequest.FunctionCallPart
import com.wavesplatform.api.http.utils.UtilsEvaluator
import com.wavesplatform.block.Block.BlockId
Expand Down Expand Up @@ -119,6 +119,7 @@ class ExtensionDomain(
override def blocksApi: CommonBlocksApi = self.blocksApi
override def accountsApi: CommonAccountsApi = self.accountsApi
override def assetsApi: CommonAssetsApi = self.assetsApi
override def generatorsApi: CommonGeneratorsApi = self.generatorsApi

override def utxEvents: Observable[UtxEvent] = Observable.empty
}
Expand Down
3 changes: 2 additions & 1 deletion src/test/scala/units/TestSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package units
import com.typesafe.config.ConfigFactory
import com.wavesplatform.account.{Address, KeyPair, PrivateKey, SeedKeyPair}
import com.wavesplatform.db.WithState.AddrWithBalance
import com.wavesplatform.history.Domain
import com.wavesplatform.settings.WavesSettings
import com.wavesplatform.state.Height
import com.wavesplatform.test.{DomainPresets, NumericExt}
Expand All @@ -23,7 +24,7 @@ case class TestSettings(
def finalAdditionalBalances: List[AddrWithBalance] = additionalBalances ++
initialMiners.collect { case x if !additionalBalances.exists(_.address == x.address) => AddrWithBalance(x.address, x.wavesBalance) }

def walletSeed: Array[Byte] = wavesSettings.walletSettings.seed.getOrElse(throw new RuntimeException("No wallet seed")).arr
def walletSeed: Array[Byte] = Domain.DefaultWalletSeed

def withEnabledElMining: TestSettings = copy(wavesSettings =
wavesSettings.copy(config = ConfigFactory.parseString("units.defaults.mining-enable = true").withFallback(wavesSettings.config))
Expand Down