Skip to content

Commit

Permalink
Fixes: removed excess files
Browse files Browse the repository at this point in the history
  • Loading branch information
vsuharnikov committed Nov 8, 2024
1 parent 3b9b229 commit 2776740
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.wavesplatform.common.state.ByteStr
import units.client.contract.HasConsensusLayerDappTxHelpers.EmptyE2CTransfersRootHashHex
import units.docker.WavesNodeContainer

class AlternativeChainTestSuite extends OneNodeTestSuite {
class AlternativeChainTestSuite extends BaseDockerTestSuite {
"L2-383 Start an alternative chain after not getting an EL-block" in {
step("EL miner #2 join")
waves1.api.broadcastAndWait(
Expand Down
72 changes: 68 additions & 4 deletions consensus-client-it/src/test/scala/units/BaseDockerTestSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ import com.typesafe.config.ConfigFactory
import com.wavesplatform.GenesisBlockGenerator
import com.wavesplatform.account.AddressScheme
import com.wavesplatform.common.state.ByteStr
import com.wavesplatform.common.utils.EitherExt2
import com.wavesplatform.utils.ScorexLogging
import monix.execution.atomic.AtomicBoolean
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers
import org.scalatest.{BeforeAndAfterAll, EitherValues, OptionValues}
import units.BaseDockerTestSuite.generateWavesGenesisConfig
import units.client.contract.HasConsensusLayerDappTxHelpers
import units.docker.Networks
import units.client.engine.model.BlockNumber
import units.docker.{EcContainer, Networks, WavesNodeContainer}
import units.eth.Gwei
import units.test.TestEnvironment.*
import units.test.{CustomMatchers, HasRetry}
Expand Down Expand Up @@ -39,9 +41,71 @@ trait BaseDockerTestSuite

protected lazy val wavesGenesisConfigPath = generateWavesGenesisConfig()

protected def startNodes(): Unit
protected def stopNodes(): Unit
protected def setupNetwork(): Unit
protected lazy val ec1: EcContainer = new EcContainer(
network = network,
number = 1,
ip = Networks.ipForNode(2) // ipForNode(1) is assigned to Ryuk
)

protected lazy val waves1: WavesNodeContainer = new WavesNodeContainer(
network = network,
number = 1,
ip = Networks.ipForNode(3),
baseSeed = "devnet-1",
clMinerKeyPair = mkKeyPair("devnet-1", 0),
chainContractAddress = chainContractAddress,
ecEngineApiUrl = s"http://${ec1.hostName}:${EcContainer.EnginePort}",
genesisConfigPath = wavesGenesisConfigPath
)

protected def startNodes(): Unit = {
ec1.start()
ec1.logPorts()

waves1.start()
waves1.waitReady()
waves1.logPorts()
}

protected def stopNodes(): Unit = {
waves1.stop()
ec1.stop()
}

protected def setupNetwork(): Unit = {
log.info("Set script")
waves1.api.broadcastAndWait(chainContract.setScript())

log.info("Setup chain contract")
val genesisBlock = ec1.engineApi.getBlockByNumber(BlockNumber.Number(0)).explicitGet().getOrElse(failRetry("No EL genesis block"))
waves1.api.broadcastAndWait(
chainContract.setup(
genesisBlock = genesisBlock,
elMinerReward = rewardAmount.amount.longValue(),
daoAddress = None,
daoReward = 0,
invoker = chainContractAccount
)
)
log.info(s"Token id: ${waves1.chainContract.token}")

log.info("EL miner #1 join")
val joinMiner1Result = waves1.api.broadcastAndWait(
chainContract.join(
minerAccount = miner11Account,
elRewardAddress = miner11RewardAddress
)
)

val epoch1Number = joinMiner1Result.height + 1
log.info(s"Wait for #$epoch1Number epoch")
waves1.api.waitForHeight(epoch1Number)
}

override protected def step(text: String): Unit = {
super.step(text)
waves1.api.print(text)
}

override def beforeAll(): Unit = {
BaseDockerTestSuite.init()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.wavesplatform.transaction.TxHelpers
import units.client.engine.model.BlockNumber
import units.eth.EthAddress

class BridgeC2ETestSuite extends OneNodeTestSuite {
class BridgeC2ETestSuite extends BaseDockerTestSuite {
private val clSender = clRichAccount1
private val elReceiver = elRichAccount1
private val elReceiverAddress = EthAddress.unsafeFrom(elReceiver.getAddress)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import org.web3j.protocol.exceptions.TransactionException
import org.web3j.utils.Convert
import units.el.ElBridgeClient

class BridgeE2CTestSuite extends OneNodeTestSuite {
class BridgeE2CTestSuite extends BaseDockerTestSuite {
private val elSender = elRichAccount1
private val clRecipient = clRichAccount1
private val userAmount = 1
Expand Down
73 changes: 0 additions & 73 deletions consensus-client-it/src/test/scala/units/OneNodeTestSuite.scala

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package units
import com.wavesplatform.common.utils.EitherExt2
import units.client.engine.model.BlockNumber

class RewardTestSuite extends OneNodeTestSuite {
class RewardTestSuite extends BaseDockerTestSuite {
"L2-234 The reward for a previous epoch is in the first block withdrawals" in {
val epoch1FirstEcBlock = retry {
ec1.engineApi.getBlockByNumber(BlockNumber.Number(1)).explicitGet().get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import org.web3j.utils.Convert

import java.math.BigInteger

class SyncingTestSuite extends OneNodeTestSuite {
class SyncingTestSuite extends BaseDockerTestSuite {
private val elSender = elRichAccount1
private val amount = Convert.toWei("1", Convert.Unit.ETHER).toBigInteger

Expand Down

0 comments on commit 2776740

Please sign in to comment.