Update libp2p node config

This commit is contained in:
Gusto 2023-09-28 15:37:09 +03:00
parent f14df0c479
commit 8275fc7817
6 changed files with 59 additions and 70 deletions

View File

@ -1,6 +1,6 @@
# BUILD IMAGE ---------------------------------------------------------
FROM rust:1.72.0-slim-bullseye AS builder
FROM rust:1.72.1-slim-bullseye AS builder
# Using backports for go 1.19
RUN echo 'deb http://deb.debian.org/debian bullseye-backports main' \

View File

@ -31,7 +31,27 @@ services:
- NODE_MASK=${DOCKER_COMPOSE_LIBP2P_NODE_KEY_MASK:-2000000000000000000000000000000000000000000000000000000000000000}
- OVERLAY_NODES=${DOCKER_COMPOSE_OVERLAY_NODES:-1000000000000000000000000000000000000000000000000000000000000000}
- NET_INITIAL_PEERS=${DOCKER_COMPOSE_NET_INITIAL_PEERS:-/dns/bootstrap/tcp/3000}
entrypoint: /etc/nomos/configure_node.sh
entrypoint: /etc/nomos/run_libp2p_node.sh
mix-node:
build:
context: .
dockerfile: testnet/Dockerfile
volumes:
- ./testnet:/etc/nomos
deploy:
replicas: ${DOCKER_COMPOSE_MIXNET_REPLICAS:-1}
depends_on:
- bootstrap
- etcd
environment:
- DOCKER_REPLICAS=${DOCKER_COMPOSE_MIXNET_REPLICAS:-1}
- ETCDCTL_ENDPOINTS=${DOCKER_COMPOSE_ETCDCTL_ENDPOINTS:-etcd:2379}
- ETCDCTL_API=${DOCKER_COMPOSE_ETCDCTL_API:-3}
- NODE_MASK=${DOCKER_COMPOSE_MIXNET_NODE_KEY_MASK:-2000000000000000000000000000000000000000000000000000000000000000}
- OVERLAY_NODES=${DOCKER_COMPOSE_OVERLAY_NODES:-1000000000000000000000000000000000000000000000000000000000000000}
- NET_INITIAL_PEERS=${DOCKER_COMPOSE_NET_INITIAL_PEERS:-/dns/bootstrap/tcp/3000}
entrypoint: /etc/nomos/run_mix_node.sh
etcd:
image: quay.io/coreos/etcd:v3.4.15

View File

@ -1,6 +1,6 @@
# BUILD IMAGE ---------------------------------------------------------
FROM rust:1.72.0-slim-bullseye AS builder
FROM rust:1.72.1-slim-bullseye AS builder
# Using backports for go 1.19
RUN echo 'deb http://deb.debian.org/debian bullseye-backports main' \
@ -8,13 +8,15 @@ RUN echo 'deb http://deb.debian.org/debian bullseye-backports main' \
# Dependecies for publishing documentation.
RUN apt-get update && apt-get install -yq \
git clang etcd-client
git clang etcd-client libssl-dev \
golang-src/bullseye-backports \
golang-doc/bullseye-backports \
golang/bullseye-backports
WORKDIR /nomos
COPY . .
RUN cargo build --release -p nomos-node
RUN cargo build --release -p mixnode
RUN cargo build --release --all
# NODE IMAGE ----------------------------------------------------------

View File

@ -1,64 +0,0 @@
log:
backend: "Stdout"
format: "Json"
level: "debug"
consensus:
private_key: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
fountain_settings: null
overlay_settings:
nodes: [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]]
number_of_committees: 1
current_leader: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
leader:
cur: 0
committee_membership: !Sad
entropy: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
network:
backend:
host: 0.0.0.0
port: 3000
log_level: "fatal"
node_key: "0000000000000000000000000000000000000000000000000000000000000001"
discV5BootstrapNodes: []
initial_peers: []
relayTopics: []
# Mixclient configuration to communicate with mixnodes.
# The libp2p network backend always requires this mixclient configuration
# (cannot be disabled for now).
mixnet_client:
# A mixclient mode. For details, see the documentation of the "mixnet" crate.
# - Sender
# - !SenderReceiver [mixnode_client_listen_address]
mode: Sender
# A mixnet topology, which contains the information of all mixnodes in the mixnet.
# (The topology is static for now.)
topology:
# Each mixnet layer consists of a list of mixnodes.
layers:
- nodes:
- address: 127.0.0.1:7777 # A listen address of the mixnode
# A ed25519 public key for encrypting Sphinx packets for the mixnode
public_key: "0000000000000000000000000000000000000000000000000000000000000000"
# A max number of connections that will stay connected to mixnodes in the first mixnet layer.
connection_pool_size: 255
# A range of total delay that will be set to each Sphinx packets
# sent to the mixnet for timing obfuscation.
# Panics if start > end.
mixnet_delay:
start: "0ms"
end: "0ms"
http:
backend:
address: 0.0.0.0:8080
cors_origins: []
da:
da_protocol:
num_attestations: 1
backend:
max_capacity: 10
evicting_period:
secs: 3600
nanos: 0

31
testnet/run_mix_node.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/sh
set -e
# Set env variables for nomos-node.
NET_NODE_KEY=$(./etc/nomos/register_node.sh)
CONSENSUS_PRIV_KEY=$NET_NODE_KEY
node_ids=$(etcdctl get "/node/" --prefix --keys-only)
for node_id in $node_ids; do
node_key=$(etcdctl get "/config${node_id}/key" --print-value-only)
node_ip=$(etcdctl get "/config${node_id}/ip" --print-value-only)
node_multiaddr="/ip4/${node_ip}/tcp/3000"
if [ -z "$OVERLAY_NODES" ]; then
OVERLAY_NODES=$node_key
NET_INITIAL_PEERS=$node_multiaddr
else
OVERLAY_NODES="${OVERLAY_NODES},${node_key}"
NET_INITIAL_PEERS="${NET_INITIAL_PEERS},${node_multiaddr}"
fi
done
export CONSENSUS_PRIV_KEY \
OVERLAY_NODES \
NET_NODE_KEY \
NET_INITIAL_PEERS
echo "I am a container ${HOSTNAME} node ${NET_NODE_KEY}"
exec /usr/bin/nomos-node /etc/nomos/config.yaml