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
17 changes: 16 additions & 1 deletion .github/workflows/check-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ name: Check PR
on:
pull_request:

concurrency:
group: check-pr-${{ github.ref }}
cancel-in-progress: true

permissions:
checks: write

jobs:
check-pr:
name: Check PR
Expand Down Expand Up @@ -46,7 +53,15 @@ jobs:
- name: Run tests
run: |
forge --version
sbt --batch "scalafmtCheck;test;docker;consensus-client-it/test"
sbt --no-colors --color=never --batch "scalafmtCheck;test;docker;consensus-client-it/test"
env:
RUN_ID: ${{ github.head_ref }}-${{ github.run_number }}-${{ github.run_attempt }}
- uses: scacap/action-surefire-report@5609ce4db72c09db044803b344a8968fd1f315da
if: always()
with:
report_paths: '**/target/test-reports/*.xml'
create_check: false
check_name: 'Check PR'
- name: Archive logs
uses: actions/upload-artifact@v4
if: always()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@ import com.wavesplatform.common.state.ByteStr
import com.wavesplatform.common.utils.EitherExt2.explicitGet
import com.wavesplatform.utils.ScorexLogging
import monix.execution.atomic.AtomicBoolean
import org.scalactic.source.Position
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers
import org.scalatest.{BeforeAndAfterAll, EitherValues, OptionValues}
import org.web3j.protocol.core.DefaultBlockParameterName
import sttp.client3.{HttpClientSyncBackend, Identity, SttpBackend}
import units.client.HttpChainContractClient
import units.client.contract.HasConsensusLayerDappTxHelpers
import units.client.engine.model.BlockNumber
import units.docker.*
import units.docker.WavesNodeContainer.generateWavesGenesisConfig
import units.el.{NativeBridgeClient, StandardBridgeClient}
import units.eth.Gwei
import units.eth.{EthAddress, Gwei}
import units.test.{CustomMatchers, IntegrationTestEventually, TestEnvironment}

import scala.sys.process.{Process, ProcessLogger}
Expand Down Expand Up @@ -115,13 +117,21 @@ trait BaseDockerTestSuite
waves1.api.waitForHeight(epoch1Number)
}

private def waitForContract(address: EthAddress)(implicit pos: Position): Unit = eventually {
ec1.web3j.ethGetCode(address.toString, DefaultBlockParameterName.LATEST).send().getCode shouldNot be("0x")
}

protected def deploySolidityContracts(): Unit = {
step("Deploy contracts on EL")
Process(
s"forge script -vvvvv scripts/IT.s.sol:IT --private-key $elRichAccount1PrivateKey --fork-url http://localhost:${ec1.rpcPort} --broadcast",
TestEnvironment.ContractsDir,
"CHAIN_ID" -> EcContainer.ChainId.toString
).!(ProcessLogger(out => log.info(out), err => log.error(err)))

waitForContract(StandardBridgeAddress)
waitForContract(WWavesAddress)
waitForContract(TErc20Address)
}

override protected def step(text: String): Unit = {
Expand Down
27 changes: 15 additions & 12 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,27 @@ Units Network node consists of Waves blockchain node, Consensus Client extension
* Generate JWT secret and execution client keys by running `./gen-keys.sh`. This script requires `openssl`.
* Optional: get waves node [state](https://docs.waves.tech/en/waves-node/options-for-getting-actual-blockchain/state-downloading-and-applying) and place it inside the `./data/waves` directory.
* Optional: get execution client state.
* To run op-geth on Linux, you need to manually create data & log directories and set appropriate permissions:
```
install -d -o 1000 -g 1000 data/op-geth logs/op-geth

## Configuring the nodes

Create `./local.env` file with the base58-encoded [seed and password](https://docs.waves.tech/en/waves-node/how-to-work-with-node-wallet) and declared addresses for both Waves and Unit Zero nodes:
```shell
WAVES_WALLET_SEED=<base58-encoded seed>
WAVES_WALLET_PASSWORD=<wallet password>
WAVES_DECLARED_ADDRESS=1.2.3.4:6868
UNITS_DECLARED_ADDRESS=1.2.3.4:6865
```
This wallet seed will be used for mining both waves and ethereum blocks, so make sure it's the correct one. Also make sure these declared addresses have distinct ports, otherwise your node will be banned from the network!

## Configuring Waves Node
* Create `./secrets.env` file with the base58-encoded [seed and password](https://docs.waves.tech/en/waves-node/how-to-work-with-node-wallet):
```
WAVES_WALLET_SEED=<base58-encoded seed>
WAVES_WALLET_PASSWORD=<wallet password>
```
This wallet seed will be used for mining both waves and ethereum blocks, so make sure it's the correct one.
* Specify the proper declared addresses in the environment file (`testnet.env` for testnet, etc.). Make sure these declared addresses have distinct ports, otherwise your node will be banned from the network!
You can also override Consensus Client image tag by adding `UNITS_IMAGE_TAG` variable to `./local.env`:
```shell
UNITS_IMAGE_TAG=snapshot
```

## Launching

Running, stopping and updating in testnet:
```
```shell
docker compose --env-file=testnet.env up -d
docker compose --env-file=testnet.env down
docker compose --env-file=testnet.env pull
Expand Down
12 changes: 7 additions & 5 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,23 @@ services:

waves-node:
container_name: waves-node
image: ghcr.io/unitsnetwork/consensus-client:${WAVES_NODE_TAG:-${NETWORK:-snapshot}}
image: ghcr.io/unitsnetwork/consensus-client:${UNITS_IMAGE_TAG:-$NETWORK}
stop_grace_period: 5m
pull_policy: always
restart: unless-stopped
environment:
JAVA_OPTS: $JAVA_OPTS -Dwaves.blockchain.type=$NETWORK -Dlogback.file.level=TRACE
WAVES_WALLET_PASSWORD: $WAVES_WALLET_PASSWORD
WAVES_WALLET_SEED: $WAVES_WALLET_SEED
JAVA_OPTS: ${JAVA_OPTS:-} -Dwaves.blockchain.type=${NETWORK:?NETWORK must be set} -Dlogback.file.level=TRACE
UNITS_CHAIN_CONTRACT:
UNITS_KNOWN_PEERS:
env_file:
- local.env
ports:
- 127.0.0.1:6869:6869
- 6868:6868
- 6865:6865
volumes:
- ./data/secrets:/etc/secrets:ro
- ./data/waves:/var/lib/waves/data
- ./waves-${NETWORK}.conf:/etc/waves/waves.conf:ro
- ./waves.conf:/etc/waves/waves.conf:ro
- ./logback.xml:/etc/waves/logback.xml
- ./logs/waves:/var/log/waves
5 changes: 5 additions & 0 deletions docker/mainnet.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
NETWORK=mainnet
NETWORKID=88811
GASLIMIT=10000000
UNITS_CHAIN_CONTRACT=3PKgN8rfmvF7hK7RWJbpvkh59e1pQkUzero
UNITS_KNOWN_PEERS=peers.unit0.dev
8 changes: 8 additions & 0 deletions docker/peers-stagenet.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Node.P2P]
BootstrapNodes = [
"enode://15865b888af15bf576ac4c3026856c6f75845e8b4702e4480124e358f7bf09e847ae6c97c86573330e6ab9d12751f5cd1fdbe61f78aee5d204a3af16811477ec@116.202.97.123:30303"
]
BootstrapNodesV5 = []
StaticNodes = [
"enode://15865b888af15bf576ac4c3026856c6f75845e8b4702e4480124e358f7bf09e847ae6c97c86573330e6ab9d12751f5cd1fdbe61f78aee5d204a3af16811477ec@116.202.97.123:30303"
]
2 changes: 1 addition & 1 deletion docker/services/op-geth.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:
op-geth:
container_name: op-geth
image: ghcr.io/unitsnetwork/op-geth:v1.101503.1-simulate-fixes
image: ghcr.io/unitsnetwork/op-geth:v1.101603.0-1
stop_grace_period: 5m
entrypoint: /bin/sh -c
environment:
Expand Down
5 changes: 5 additions & 0 deletions docker/stagenet.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
NETWORK=stagenet
NETWORKID=88819
GASLIMIT=10000000
UNITS_CHAIN_CONTRACT=3MjDHGn2ZbeXYj7YQ5ALArv5R2Vy914Phf7
UNITS_KNOWN_PEERS=peers-stagenet.unit0.dev:6865
5 changes: 2 additions & 3 deletions docker/testnet.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
NETWORK=testnet
NETWORKID=88817
GASLIMIT=10000000
WAVES_KNOWN_PEERS=[testnet-l2-htz-hel1-1.wavesnodes.com:6865]
#WAVES_DECLARED_ADDRESS=1.2.3.4:6868
#UNITS_DECLARED_ADDRESS=1.2.3.4:6865
UNITS_CHAIN_CONTRACT=3Msx4Aq69zWUKy4d1wyKnQ4ofzEDAfv5Ngf
UNITS_KNOWN_PEERS=peers-testnet.unit0.dev
44 changes: 0 additions & 44 deletions docker/waves-testnet.conf

This file was deleted.

5 changes: 2 additions & 3 deletions docker/waves-mainnet.conf → docker/waves.conf
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,15 @@ waves {
units {
chains = [
{
chain-contract = 3PKgN8rfmvF7hK7RWJbpvkh59e1pQkUzero
chain-contract = ${UNITS_CHAIN_CONTRACT}
execution-client-address = "http://op-geth:8551"
jwt-secret-file = /etc/secrets/jwtsecret

network {
port = 6865
declared-address = ${?UNITS_DECLARED_ADDRESS}
known-peers = ${WAVES_KNOWN_PEERS}
known-peers = [${UNITS_KNOWN_PEERS}]
}
mining-enable = no
}
]
}