Skip to content

Commit

Permalink
Merge branch 'main' into better-validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Mashonskii committed Sep 16, 2024
2 parents d2ca202 + 6d10b34 commit 0278e98
Show file tree
Hide file tree
Showing 82 changed files with 894 additions and 882 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ jobs:
java-version: '11'
cache: 'sbt'
- name: Check PR
run: sbt --batch "compile"
run: sbt --batch "compile;test"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
target
.bsp
.idea
Expand Down
3 changes: 2 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ name := "consensus-client"
maintainer := "Units Network Team"
resolvers ++= Resolver.sonatypeOssRepos("releases") ++ Resolver.sonatypeOssRepos("snapshots") ++ Seq(Resolver.mavenLocal)
libraryDependencies ++= Seq(
"com.wavesplatform" % "node" % "1.5.7" % "provided",
"com.wavesplatform" % "node-testkit" % "1.5.7-3964-SNAPSHOT" % "test",
"com.wavesplatform" % "node" % "1.5.7-3964-SNAPSHOT" % "provided",
"com.softwaremill.sttp.client3" % "core_2.13" % "3.9.8",
"com.softwaremill.sttp.client3" %% "play-json" % "3.9.8",
"com.github.jwt-scala" %% "jwt-play-json" % "10.0.1"
Expand Down
2 changes: 0 additions & 2 deletions local-network/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.DS_Store
.idea
.env
.cache/
data/
10 changes: 6 additions & 4 deletions local-network/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ See [./deploy](./deploy/).
# Keys

* Node HTTP API Key: `testapi`
* CL accounts (see [genesis-template.conf](./configs/wavesnode/common/genesis-template.conf) for more information):
* CL accounts (see [genesis-template.conf](configs/wavesnode/genesis-template.conf) for more information):
* Node wallet seed:
* wavesnode-1: `devnet-1`
* wavesnode-2: `devnet-2`
Expand All @@ -43,7 +43,7 @@ See [./deploy](./deploy/).
* Address: `0xcF0b9E13FDd593f4Ca26D36aFCaA44dd3FDCCbeD`
* Private key: `ab49fee4fc326ecbc7abc7f2e5870bf1f86076eb0979c524e20c843f2a73f647`
* To see all information, run `npx tsx common-settings-show.ts` from [./deploy](./deploy/) directory.
* Ethereum addresses and private keys for `besu` nodes in [config](./configs/besu/generated/genesis.json):
* Ethereum addresses and private keys for `besu` nodes in [config](configs/ec-common/genesis.json):
* `fe3b557e8fb62b89f4916b721be55ceb828dbd73`: `8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63`
* `f17f52151EbEF6C7334FAD080c5704D77216b732`: `ae6ae8e5ccbfb04590405997ee2d52d2b330726137b875053c36d94e974d162f`

Expand All @@ -57,6 +57,8 @@ a non-empty balance. So you can use them to issue transactions on EL.
* wavesnode-1: http://127.0.0.1:16869/
* wavesnode-2: http://127.0.0.1:26869/

If you need a JWT token for authenticated APIs, use [generate.sh](configs/ec-common/generate.sh).

# How to set up Metamask

Settings:
Expand Down Expand Up @@ -100,5 +102,5 @@ See [Besu configuration](configs/besu/).

## How to change Waves initial miners or time between blocks

1. Update [genesis-template.conf](./configs/wavesnode/common/genesis-template.conf).
2. [genesis.conf](./configs/wavesnode/common/genesis.conf) will be updated in [restart.sh](./restart.sh).
1. Update [genesis-template.conf](configs/wavesnode/genesis-template.conf).
2. [genesis.conf](configs/wavesnode/genesis.conf) will be updated in [restart.sh](./restart.sh).
3 changes: 0 additions & 3 deletions local-network/configs/besu/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# Besu configs

Use [./generate-configs.sh](generate-configs.sh) to generate `genesis.json` and keys for nodes.
Note: it always generates new keys! So, don't use it if you don't need to add nodes.

## Manual connecting

Follow [https://besu.hyperledger.org/stable/private-networks/tutorials/permissioning](instructions):
Expand Down
41 changes: 0 additions & 41 deletions local-network/configs/besu/besu-2.conf

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# /opt/besu belongs to besu user: https://github.com/hyperledger/besu/blob/main/docker/openjdk-17/Dockerfile
# so it is the only writable path
data-path = "/opt/besu/data"
genesis-file = "/config/generated/genesis.json"
node-private-key-file = "/config/generated/keys/0x71b67256532de0cb71609d1cf107744b7d0ed1bb/key"
genesis-file = "/genesis.json"
node-private-key-file = "/etc/secrets/p2p-key"

sync-mode = "FULL"
host-allowlist = ["*"]
Expand All @@ -20,24 +20,26 @@ rpc-http-enabled = true
rpc-http-host = "0.0.0.0"
rpc-http-port = 8545
rpc-http-cors-origins = ["*"]
# Disabled: ["EEA", "PRIV"]
rpc-http-api = ["ADMIN", "CLIQUE", "DEBUG", "ETH", "IBFT", "MINER", "NET", "PERM", "PLUGINS", "QBFT", "TRACE", "TXPOOL", "WEB3"]

engine-rpc-enabled = true
engine-rpc-port = 8551
engine-host-allowlist = ["*"]
engine-jwt-disabled = true

rpc-ws-enabled = true
rpc-http-api = ["ADMIN", "CLIQUE", "DEBUG", "EEA", "ETH", "IBFT", "MINER", "NET", "PERM", "PLUGINS", "PRIV", "QBFT", "TRACE", "TXPOOL", "WEB3"]
rpc-ws-api = ["ADMIN", "CLIQUE", "DEBUG", "ETH", "IBFT", "MINER", "NET", "PERM", "PLUGINS", "QBFT", "TRACE", "TXPOOL", "WEB3"]

p2p-enabled = true
p2p-interface = "0.0.0.0"
# p2p-host = "see run-besu.sh"
p2p-port = 30303

discovery-enabled = true
nat-method = "NONE"

Xdns-enabled = true
Xdns-update-enabled = true
bootnodes = [
"enode://b2ce9caff5e7472eafaf006904e2cb39cdd79801cda1328c510118cafdb0e9574526af6d05a89dae07a376606227c54c724cab1e88edf43190b7544976b275b8@besu-1:30303",
"enode://4e355eebfd77e5c2c0c20328c2bd5f3fde033c58e06e758c3e0a4ad88e8ced176f0d5eb32e214461b73e014591587f7c6567ee373e9c389b872a6d97d74a913c@besu-2:30303"
]
# bootnodes = [ see BESU_BOOTNODES in peers.env ]

tx-pool-max-future-by-sender = "1250"
12 changes: 12 additions & 0 deletions local-network/configs/besu/besu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
services:
besu:
image: hyperledger/besu:latest # Debug version: besu-debug:latest , see _debug/
volumes:
- ../ec-common/genesis.json:/genesis.json:ro
- .:/config:ro
- ./run-besu.sh:/tmp/run.sh:ro
env_file:
- ../ec-common/peers.env
environment:
LOG4J_CONFIGURATION_FILE: /config/log4j2.xml
entrypoint: /tmp/run.sh
10 changes: 0 additions & 10 deletions local-network/configs/besu/generate-configs.sh

This file was deleted.

42 changes: 0 additions & 42 deletions local-network/configs/besu/generated/genesis.json

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion local-network/configs/besu/log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout alwaysWriteExceptions="false" pattern='${root.log.pattern}'/>
</Console>
<RollingFile name="RollingFile" fileName="/opt/besu/logs/besu.log" filePattern="/opt/besu/logs/besu-%d{MM-dd-yyyy}-%i.log.gz" >
<RollingFile name="RollingFile" fileName="/opt/besu/logs/log" filePattern="/opt/besu/logs/%d{MM-dd-yyyy}-%i.log.gz" >
<PatternLayout alwaysWriteExceptions="false" pattern='${root.log.pattern}'/>
<Policies>
<TimeBasedTriggeringPolicy />
Expand Down
8 changes: 8 additions & 0 deletions local-network/configs/besu/run-besu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env sh

IP=$(hostname -I)

# --p2p-host="ec-1" # Doesn't work: https://github.com/hyperledger/besu/issues/4380
besu \
--config-file=/config/besu.conf \
--p2p-host=${IP}
6 changes: 3 additions & 3 deletions local-network/configs/blockscout/backend/bs-backend.env
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
ETHEREUM_JSONRPC_VARIANT=besu
ETHEREUM_JSONRPC_HTTP_URL=http://besu-1:8545/
ETHEREUM_JSONRPC_HTTP_URL=http://ec-1:8545/
# ETHEREUM_JSONRPC_FALLBACK_HTTP_URL=
DATABASE_URL=postgresql://blockscout:ceWb1MeLBEeOIfk65gU8EjF8@db:5432/blockscout
# DATABASE_QUEUE_TARGET
ETHEREUM_JSONRPC_TRACE_URL=http://besu:8545/
ETHEREUM_JSONRPC_TRACE_URL=http://ec-1:8545/
# ETHEREUM_JSONRPC_FALLBACK_TRACE_URL=
# ETHEREUM_JSONRPC_ETH_CALL_URL=
# ETHEREUM_JSONRPC_HTTP_TIMEOUT=
# CHAIN_TYPE=
NETWORK=
SUBNETWORK=Awesome chain
LOGO=/images/blockscout_logo.svg
ETHEREUM_JSONRPC_WS_URL=ws://besu-1:8546/
ETHEREUM_JSONRPC_WS_URL=ws://ec-1:8546/
ETHEREUM_JSONRPC_TRANSPORT=http
ETHEREUM_JSONRPC_DISABLE_ARCHIVE_BALANCES=false
# ETHEREUM_JSONRPC_ARCHIVE_BALANCES_WINDOW=200
Expand Down
2 changes: 1 addition & 1 deletion local-network/configs/blockscout/enabled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
depends_on:
- db
- redis
- besu-1
- ec-1
extends:
file: ./backend/backend.yml
service: backend
Expand Down
12 changes: 6 additions & 6 deletions local-network/configs/blockscout/nginx/nginx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ services:
environment:
BACK_PROXY_PASS: ${BACK_PROXY_PASS:-http://bs-backend:4000}
FRONT_PROXY_PASS: ${FRONT_PROXY_PASS:-http://bs-frontend:3000}
BESU_RPC_PROXY_PASS: ${BESU_RPC_PROXY_PASS:-http://besu-1:8545}
BESU_WS_PROXY_PASS: ${BESU_WS_PROXY_PASS:-http://besu-1:8546}
BESU_RPC_PROXY_PASS: ${BESU_RPC_PROXY_PASS:-http://ec-1:8545}
BESU_WS_PROXY_PASS: ${BESU_WS_PROXY_PASS:-http://ec-1:8546}
WAVES_PROXY_PASS: ${WAVES_PROXY_PASS:-http://wavesnode-1:6869}
ports:
- '0.0.0.0:3000:3000'
- '0.0.0.0:3001:3001'
- '0.0.0.0:3002:3002'
- '0.0.0.0:10001:10001'
- '127.0.0.1:3000:3000'
- '127.0.0.1:3001:3001'
- '127.0.0.1:3002:3002'
- '127.0.0.1:10001:10001'
1 change: 1 addition & 0 deletions local-network/configs/ec-common/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
jwt-token-*.hex
27 changes: 27 additions & 0 deletions local-network/configs/ec-common/generate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash

DIR="$(cd "$(dirname "$0")" && pwd)"
cd "${DIR}" || exit

for N in {1..4}; do
p2p_file="p2p-key-${N}.hex"
jwt_file="jwt-secret-${N}.hex"
jwt_token_file="jwt-token-${N}.hex"

# Generate p2p key without newline
if [ ! -f "$p2p_file" ]; then
openssl rand 32 | xxd -p -c 32 | tr -d '\n' > "$p2p_file"
echo "Created $p2p_file"
fi

# Generate JWT secret without newline
if [ ! -f "$jwt_file" ]; then
openssl rand 32 | xxd -p -c 32 | tr -d '\n' > "$jwt_file"
echo "Created $jwt_file"
fi

# Generate JWT token
secret=$(cat "$jwt_file")
./jwt-token-generate.sh "$secret" > "$jwt_token_file"
echo "Generated JWT token in $jwt_token_file"
done
Loading

0 comments on commit 0278e98

Please sign in to comment.