Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
14 changes: 13 additions & 1 deletion .github/workflows/check-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: Check PR
on:
pull_request:

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

jobs:
check-pr:
name: Check PR
Expand Down Expand Up @@ -46,7 +50,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: true
check_name: 'Check PR'
- name: Archive logs
uses: actions/upload-artifact@v4
if: always()
Expand Down
22 changes: 22 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
import com.github.sbt.git.SbtGit.GitKeys.gitCurrentBranch
import sbt.Def
import sbt.internal.RelayAppender
import sbt.util.Level

enablePlugins(UniversalDeployPlugin, GitVersioning, sbtdocker.DockerPlugin, VersionObject)

extraAppenders := {
extraAppenders.value

(s: Def.ScopedKey[?]) =>
new RelayAppender("RELAY") {
override def appendLog(level: Level.Value, message: => String): Unit = {
if (level >= Level.Warn) {
println(s)
val lines = message.split("\n")
if (lines.length > 1)
println(s"::$level file=,title=${lines(0)}::${lines.tail.mkString("%0A")}")
else
println(s"::$level::$message")
}
super.appendLog(level, message)
}
} +: extraAppenders.value(s)
}

git.useGitDescribe := true
git.baseVersion := "1.1.0"
git.uncommittedSignifier := Some("DIRTY")
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
}
]
}
2 changes: 1 addition & 1 deletion src/main/scala/units/ELUpdater.scala
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class ELUpdater(
def executionBlockReceived(block: NetworkL2Block, ch: Channel): Unit = scheduler.execute { () =>
logger.debug(s"New block ${block.hash}->${block.parentHash} (timestamp=${block.timestamp}, height=${block.height}) appeared")

val now = time.correctedTime() / 1000
val now = time.correctedTime() /\ 1000
if (block.timestamp - now <= MaxTimeDrift) {
state match {
case WaitingForSyncHead(target, _) if block.hash == target.hash =>
Expand Down
Loading