Unverified Commit 4a4c8265 authored by Evan Vigil-McClanahan's avatar Evan Vigil-McClanahan Committed by GitHub
Browse files

Merge pull request #629 from helium/pevm/validators

Validators
parents b1d0f8d3 8aac745b
Showing with 614 additions and 15 deletions
+614 -15
......@@ -11,7 +11,80 @@ steps:
artifact_paths:
- "artifacts/*"
- if: build.tag != null
- if: build.tag =~ /^validator/
name: ":debian: build validator deb"
commands:
- "git fetch -t"
- "./rebar3 as validator release"
- ".buildkite/scripts/make_deb.sh"
key: "deb"
artifact_paths: "*.deb"
# depends_on: "tests" # can't do this right now with the test status as it is.
agents:
queue: "erlang"
- if: build.tag =~ /^validator/
name: ":cloud: upload validator deb to packagecloud"
commands:
- "git fetch -t"
- ".buildkite/scripts/packagecloud_upload.sh"
depends_on: "deb"
agents:
queue: "erlang"
- if: build.tag =~ /^validator/
name: "validator AMD64 docker"
env:
REGISTRY_HOST: "quay.io"
REGISTRY_NAME: "validator"
IMAGE_FORMAT: "docker"
IMAGE_ARCH: "amd64"
agents:
queue: "erlang"
commands:
- "git fetch -t"
- ".buildkite/scripts/make_val_image.sh"
- if: build.tag =~ /^validator/
name: "validator ARM64 docker"
env:
REGISTRY_HOST: "quay.io"
REGISTRY_NAME: "validator"
IMAGE_FORMAT: "docker"
IMAGE_ARCH: "arm64"
agents:
queue: "arm64"
commands:
- "git fetch -t"
- ".buildkite/scripts/make_val_image.sh"
- if: build.tag =~ /^val\d/
name: "testnet validator AMD64 docker"
env:
REGISTRY_HOST: "quay.io"
REGISTRY_NAME: "validator"
IMAGE_FORMAT: "docker"
IMAGE_ARCH: "amd64"
agents:
queue: "erlang"
commands:
- "git fetch -t"
- ".buildkite/scripts/make_testval_image.sh"
- if: build.tag =~ /^val\d/
name: "testnet validator ARM64 docker"
env:
REGISTRY_HOST: "quay.io"
REGISTRY_NAME: "validator"
IMAGE_FORMAT: "docker"
IMAGE_ARCH: "arm64"
agents:
queue: "arm64"
commands:
- "git fetch -t"
- ".buildkite/scripts/make_testval_image.sh"
- if: build.tag != null && build.tag !~ /^validator/ && build.tag !~ /^val\d/
name: ":whale: AMD64 docker"
env:
REGISTRY_HOST: "quay.io"
......@@ -24,7 +97,7 @@ steps:
- "git fetch -t"
- ".buildkite/scripts/make_image.sh"
- if: build.tag != null
- if: build.tag != null && build.tag !~ /^validator/ && build.tag !~ /^val\d/
name: ":whale: ARM64 docker"
agents:
queue: "arm64"
......
FROM erlang:22.3.2-alpine as builder
RUN apk add --no-cache --update \
git tar build-base linux-headers autoconf automake libtool pkgconfig \
dbus-dev bzip2 bison flex gmp-dev cmake lz4 libsodium-dev openssl-dev \
sed wget curl
# Install Rust toolchain
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
WORKDIR /usr/src/miner
ENV CC=gcc CXX=g++ CFLAGS="-U__sun__" \
ERLANG_ROCKSDB_OPTS="-DWITH_BUNDLE_SNAPPY=ON -DWITH_BUNDLE_LZ4=ON" \
ERL_COMPILER_OPTIONS="[deterministic]" \
PATH="/root/.cargo/bin:$PATH" \
RUSTFLAGS="-C target-feature=-crt-static"
# Add our code
ADD . /usr/src/miner/
RUN ./rebar3 as docker_testval tar
RUN mkdir -p /opt/docker
RUN tar -zxvf _build/docker_testval/rel/*/*.tar.gz -C /opt/docker
RUN mkdir -p /opt/docker/update
RUN wget https://snapshots.helium.wtf/genesis.testnet
RUN cp genesis.testnet /opt/docker/update/genesis
#RUN wget https://github.com/helium/blockchain-api/raw/master/priv/prod/genesis
#RUN cp genesis /opt/docker/update/genesis
FROM erlang:22.3.2-alpine as runner
RUN apk add --no-cache --update ncurses dbus gmp libsodium gcc
RUN ulimit -n 64000
WORKDIR /opt/miner
ENV COOKIE=miner \
# Write files generated during startup to /tmp
RELX_OUT_FILE_PATH=/tmp \
# add miner to path, for easy interactions
PATH=$PATH:/opt/miner/bin
COPY --from=builder /opt/docker /opt/miner
ENTRYPOINT ["/opt/miner/bin/miner"]
CMD ["foreground"]
FROM arm64v8/erlang:22.3.2-alpine as builder
RUN apk add --no-cache --update \
git tar build-base linux-headers autoconf automake libtool pkgconfig \
dbus-dev bzip2 bison flex gmp-dev cmake lz4 libsodium-dev openssl-dev \
sed wget curl
# Install Rust toolchain
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
WORKDIR /usr/src/miner
ENV CC=gcc CXX=g++ CFLAGS="-U__sun__" \
ERLANG_ROCKSDB_OPTS="-DWITH_BUNDLE_SNAPPY=ON -DWITH_BUNDLE_LZ4=ON" \
ERL_COMPILER_OPTIONS="[deterministic]" \
PATH="/root/.cargo/bin:$PATH" \
RUSTFLAGS="-C target-feature=-crt-static"
# Add our code
ADD . /usr/src/miner/
RUN ./rebar3 as docker_testval tar
RUN mkdir -p /opt/docker
RUN tar -zxvf _build/docker_testval/rel/*/*.tar.gz -C /opt/docker
RUN mkdir -p /opt/docker/update
RUN wget https://snapshots.helium.wtf/genesis.testnet
RUN cp genesis.testnet /opt/docker/update/genesis
# RUN wget https://github.com/helium/blockchain-api/raw/master/priv/prod/genesis
# RUN cp genesis /opt/docker/update/genesis
FROM arm64v8/erlang:22.3.2-alpine as runner
RUN apk add --no-cache --update ncurses dbus gmp libsodium gcc
RUN ulimit -n 64000
WORKDIR /opt/miner
ENV COOKIE=miner \
# Write files generated during startup to /tmp
RELX_OUT_FILE_PATH=/tmp \
# add miner to path, for easy interactions
PATH=$PATH:/opt/miner/bin
COPY --from=builder /opt/docker /opt/miner
ENTRYPOINT ["/opt/miner/bin/miner"]
CMD ["foreground"]
FROM erlang:22.3.2-alpine as builder
RUN apk add --no-cache --update \
git tar build-base linux-headers autoconf automake libtool pkgconfig \
dbus-dev bzip2 bison flex gmp-dev cmake lz4 libsodium-dev openssl-dev \
sed wget curl
# Install Rust toolchain
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
WORKDIR /usr/src/miner
ENV CC=gcc CXX=g++ CFLAGS="-U__sun__" \
ERLANG_ROCKSDB_OPTS="-DWITH_BUNDLE_SNAPPY=ON -DWITH_BUNDLE_LZ4=ON" \
ERL_COMPILER_OPTIONS="[deterministic]" \
PATH="/root/.cargo/bin:$PATH" \
RUSTFLAGS="-C target-feature=-crt-static"
# Add our code
ADD . /usr/src/miner/
RUN ./rebar3 as docker_val tar
RUN mkdir -p /opt/docker
RUN tar -zxvf _build/docker_val/rel/*/*.tar.gz -C /opt/docker
RUN mkdir -p /opt/docker/update
RUN wget https://github.com/helium/blockchain-api/raw/master/priv/prod/genesis
RUN cp genesis /opt/docker/update/genesis
FROM erlang:22.3.2-alpine as runner
RUN apk add --no-cache --update ncurses dbus gmp libsodium gcc
RUN ulimit -n 64000
WORKDIR /opt/miner
ENV COOKIE=miner \
# Write files generated during startup to /tmp
RELX_OUT_FILE_PATH=/tmp \
# add miner to path, for easy interactions
PATH=$PATH:/opt/miner/bin
COPY --from=builder /opt/docker /opt/miner
ENTRYPOINT ["/opt/miner/bin/miner"]
CMD ["foreground"]
FROM arm64v8/erlang:22.3.2-alpine as builder
RUN apk add --no-cache --update \
git tar build-base linux-headers autoconf automake libtool pkgconfig \
dbus-dev bzip2 bison flex gmp-dev cmake lz4 libsodium-dev openssl-dev \
sed wget curl
# Install Rust toolchain
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
WORKDIR /usr/src/miner
ENV CC=gcc CXX=g++ CFLAGS="-U__sun__" \
ERLANG_ROCKSDB_OPTS="-DWITH_BUNDLE_SNAPPY=ON -DWITH_BUNDLE_LZ4=ON" \
ERL_COMPILER_OPTIONS="[deterministic]" \
PATH="/root/.cargo/bin:$PATH" \
RUSTFLAGS="-C target-feature=-crt-static"
# Add our code
ADD . /usr/src/miner/
RUN ./rebar3 as docker_val tar
RUN mkdir -p /opt/docker
RUN tar -zxvf _build/docker_val/rel/*/*.tar.gz -C /opt/docker
RUN mkdir -p /opt/docker/update
RUN wget https://github.com/helium/blockchain-api/raw/master/priv/prod/genesis
RUN cp genesis /opt/docker/update/genesis
FROM arm64v8/erlang:22.3.2-alpine as runner
RUN apk add --no-cache --update ncurses dbus gmp libsodium gcc
RUN ulimit -n 64000
WORKDIR /opt/miner
ENV COOKIE=miner \
# Write files generated during startup to /tmp
RELX_OUT_FILE_PATH=/tmp \
# add miner to path, for easy interactions
PATH=$PATH:/opt/miner/bin
COPY --from=builder /opt/docker /opt/miner
ENTRYPOINT ["/opt/miner/bin/miner"]
CMD ["foreground"]
#!/usr/bin/env bash
set -euo pipefail
fpm -n validator \
-v $(git describe --abbrev=0 --tags | sed -e s/val//) \
-s dir \
-t deb \
--depends libssl1.1 \
--depends libsodium23 \
--deb-systemd deb/miner.service \
--deb-no-default-config-files \
_build/validator/rel/=/var/helium
#!/bin/bash
set -euo pipefail
# MINER_REGISTRY_NAME
# IMAGE_ARCH
# IMAGE_FORMAT
# all come from pipeline.yml
MINER_REGISTRY_NAME="$REGISTRY_HOST/team-helium/$REGISTRY_NAME"
DOCKER_NAME="$(basename $(pwd))-${IMAGE_ARCH}_testnet_${BUILDKITE_TAG}"
DOCKERFILE_NAME=".buildkite/scripts/Dockerfile-testval-${IMAGE_ARCH}"
docker login -u="team-helium+buildkite" -p="${QUAY_BUILDKITE_PASSWORD}" ${REGISTRY_HOST}
docker build -t helium:$DOCKER_NAME -f "${DOCKERFILE_NAME}" .
docker tag helium:$DOCKER_NAME "$MINER_REGISTRY_NAME:$DOCKER_NAME"
docker push "$MINER_REGISTRY_NAME:$DOCKER_NAME"
docker tag helium:$DOCKER_NAME "$MINER_REGISTRY_NAME:latest-val-${IMAGE_ARCH}"
docker push "$MINER_REGISTRY_NAME:latest-val-${IMAGE_ARCH}"
#!/bin/bash
set -euo pipefail
# MINER_REGISTRY_NAME
# IMAGE_ARCH
# IMAGE_FORMAT
# all come from pipeline.yml
MINER_REGISTRY_NAME="$REGISTRY_HOST/team-helium/$REGISTRY_NAME"
DOCKER_NAME="$(basename $(pwd))-${IMAGE_ARCH}_${BUILDKITE_TAG}"
DOCKERFILE_NAME=".buildkite/scripts/Dockerfile-val-${IMAGE_ARCH}"
docker login -u="team-helium+buildkite" -p="${QUAY_BUILDKITE_PASSWORD}" ${REGISTRY_HOST}
docker build -t helium:$DOCKER_NAME -f "${DOCKERFILE_NAME}" .
docker tag helium:$DOCKER_NAME "$MINER_REGISTRY_NAME:$DOCKER_NAME"
docker push "$MINER_REGISTRY_NAME:$DOCKER_NAME"
docker tag helium:$DOCKER_NAME "$MINER_REGISTRY_NAME:latest-validator-${IMAGE_ARCH}"
docker push "$MINER_REGISTRY_NAME:latest-validator-${IMAGE_ARCH}"
#!/usr/bin/env bash
set -euo pipefail
PKGNAME="validator_$(git describe --long --always)_amd64.deb"
buildkite-agent artifact download ${PKGNAME} .
curl -u "${PACKAGECLOUD_API_KEY}:" \
-F "package[distro_version_id]=190" \
-F "package[package_file]=@${PKGNAME}" \
https://packagecloud.io/api/v1/repos/helium/validators/packages.json
%% -*- erlang -*-
[
"config/sys.config",
{lager,
[
{log_root, "/var/data/log"},
{handlers,
[
{lager_file_backend, [{file, "console.log"}, {size, 52428800}, {level, info}]},
{lager_file_backend, [{file, "error.log"}, {size, 52428800}, {level, error}]}
]}
]},
{blockchain,
[
{seed_nodes, "/ip4/3.12.155.25/tcp/2154"},
{seed_node_dns, ""},
{ports, [2154]},
{honor_quick_sync, true},
{quick_sync_mode, blessed_snapshot},
{blessed_snapshot_block_height, 15121},
{blessed_snapshot_block_hash,
<<212,153,235,149,144,169,179,243,176,156,92,202,217,40,119,223,177,191,83,51,215,65,206,217,63,112,27,245,207,218,100,196>>},
{validation_width, 8},
{key, undefined},
{relay_limit, 100},
{base_dir, "/var/data"},
{gw_cache_retention_limit, 76},
{gw_context_cache_max_size, 500}
]},
{libp2p,
[
{nat_map, #{ {"${NAT_INTERNAL_IP}", "${NAT_INTERNAL_PORT}"} => {"${NAT_EXTERNAL_IP}", "${NAT_EXTERNAL_PORT}"}}}
]},
{relcast,
[
{pipeline_depth, 125}
]},
{rocksdb,
[{global_opts,
[
{compaction_style, universal},
{block_based_table_options, [{cache_index_and_filter_blocks, true}]},
{max_write_buffer_number, 16},
{keep_log_file_num, 10}
]}
]},
{miner,
[
{mode, validator},
{stabilization_period, 8000},
{network, testnet},
%% these two now disable all the poc stuff
{use_ebus, false},
{radio_device, undefined},
%% dont perform regionalised checks in dev envs
%% we only realy need the params below if this file is changed to specify a radio device
%% as without one miner_lora is not started
%% including the params anyway in case someone needs it in this env
{region_override, 'US915'}
]}
].
%% -*- erlang -*-
[
"config/sys.config",
{lager,
[
{log_root, "/var/data/log"},
{handlers,
[
{lager_file_backend, [{file, "console.log"}, {size, 52428800}, {level, info}]},
{lager_file_backend, [{file, "error.log"}, {size, 52428800}, {level, error}]}
]}
]},
{blockchain,
[
{ports, [2154]},
{validation_width, 8},
{key, undefined},
{relay_limit, 100},
{base_dir, "/var/data"}
]},
{libp2p,
[
{nat_map, #{ {"${NAT_INTERNAL_IP}", "${NAT_INTERNAL_PORT}"} => {"${NAT_EXTERNAL_IP}", "${NAT_EXTERNAL_PORT}"}}}
]},
{relcast,
[
{pipeline_depth, 125}
]},
{rocksdb,
[{global_opts,
[
{compaction_style, universal},
{block_based_table_options, [{cache_index_and_filter_blocks, true}]},
{max_write_buffer_number, 16},
{keep_log_file_num, 10}
]}
]},
{miner,
[
{mode, validator},
%% these two now disable all the poc stuff
{use_ebus, false},
{radio_device, undefined},
%% dont perform regionalised checks in dev envs
%% we only realy need the params below if this file is changed to specify a radio device
%% as without one miner_lora is not started
%% including the params anyway in case someone needs it in this env
{region_override, 'US915'}
]}
].
......@@ -71,7 +71,6 @@
{defer_time_threshold, 1000}
]},
{rocksdb,
[{global_opts,
[
{max_open_files, 128},
......@@ -87,6 +86,7 @@
]},
{miner,
[
{mode, gateway},
{use_ebus, true},
{batch_size, 2500},
{curve, 'SS512'},
......
......@@ -22,6 +22,7 @@
]},
{miner,
[
{mode, validator},
{use_ebus, false},
{block_time, 500},
{election_interval, 10},
......
%% -*- erlang -*-
[
"config/sys.config",
{lager,
[
{log_root, "log"},
{handlers,
[
{lager_file_backend, [{file, "console.log"}, {size, 52428800}, {level, info}]},
{lager_file_backend, [{file, "error.log"}, {size, 52428800}, {level, error}]}
]}
]},
{blockchain,
[
{seed_nodes, "/ip4/3.12.155.25/tcp/2154"},
{seed_node_dns, ""},
{ports, [2154]},
{honor_quick_sync, true},
{quick_sync_mode, blessed_snapshot},
{blessed_snapshot_block_height, 15121},
{blessed_snapshot_block_hash,
<<212,153,235,149,144,169,179,243,176,156,92,202,217,40,119,223,177,191,83,51,215,65,206,217,63,112,27,245,207,218,100,196>>},
{key, undefined},
{relay_limit, 100},
{base_dir, "data"},
{gw_cache_retention_limit, 76},
{gw_context_cache_max_size, 500}
]},
{libp2p,
[
{nat_map, #{ {"${NAT_INTERNAL_IP}", "${NAT_INTERNAL_PORT}"} => {"${NAT_EXTERNAL_IP}", "${NAT_EXTERNAL_PORT}"}}}
]
},
{relcast,
[
{pipeline_depth, 125}
]},
{rocksdb,
[{global_opts,
[
{compaction_style, universal},
{block_based_table_options, [{cache_index_and_filter_blocks, true}]},
{max_write_buffer_number, 16},
{keep_log_file_num, 10}
]}
]},
{miner,
[
{mode, validator},
{stabilization_period, 8000},
{network, testnet},
%% these two now disable all the poc stuff
{use_ebus, false},
{radio_device, undefined},
%% dont perform regionalised checks in dev envs
%% we only realy need the params below if this file is changed to specify a radio device
%% as without one miner_lora is not started
%% including the params anyway in case someone needs it in this env
{region_override, 'US915'}
]}
].
%% -*- erlang -*-
[
"config/sys.config",
{lager,
[
{log_root, "log"},
{handlers,
[
{lager_file_backend, [{file, "console.log"}, {size, 52428800}, {level, info}]},
{lager_file_backend, [{file, "error.log"}, {size, 52428800}, {level, error}]}
]}
]},
{blockchain,
[
{ports, [2154]},
{key, undefined},
{relay_limit, 100},
{base_dir, "data"}
]},
{libp2p,
[
{nat_map, #{ {"${NAT_INTERNAL_IP}", "${NAT_INTERNAL_PORT}"} => {"${NAT_EXTERNAL_IP}", "${NAT_EXTERNAL_PORT}"}}}
]
},
{relcast,
[
{pipeline_depth, 125}
]},
{rocksdb,
[{global_opts,
[
{compaction_style, universal},
{block_based_table_options, [{cache_index_and_filter_blocks, true}]},
{max_write_buffer_number, 16},
{keep_log_file_num, 10}
]}
]},
{miner,
[
{mode, validator},
%% these two now disable all the poc stuff
{use_ebus, false},
{radio_device, undefined},
%% dont perform regionalised checks in dev envs
%% we only realy need the params below if this file is changed to specify a radio device
%% as without one miner_lora is not started
%% including the params anyway in case someone needs it in this env
{region_override, 'US915'}
]}
].
## Name of the node
-name val_{{release_name}}@127.0.0.1
## Cookie for distributed erlang
-setcookie {{release_name}}
## we are time warp safe
+c true
+C multi_time_warp
+sbwt very_short
+stbt db
+sub true
+swt very_low
[Unit]
Description=miner instance
After=network.target
[Service]
Type=simple
ExecStart=/var/helium/miner/bin/miner foreground
ExecStop=/var/helium/miner/bin/miner stop
User=ubuntu
PIDFile=/var/data/miner/miner.pid
Environment=HOME="/var/data/miner"
Environment=RUNNER_LOG_DIR="/var/data/log/miner"
Environment=ERL_CRASH_DUMP="/var/data/log/miner"
LimitNOFILE=64000
LimitNPROC=64000
Restart=always
[Install]
WantedBy=multi-user.target
......@@ -13,7 +13,7 @@ while true; do
./cmd.sh $I stop
else
export I=$(( $I - $N))
if [ $(./cmd.sh $I ping) = "pong" ]; then
if [ "$(./cmd.sh $I ping)" = "pong" ]; then
MURDERPID=$(./cmd.sh $I eval 'list_to_integer(os:getpid())')
kill -9 $MURDERPID
fi
......
version: '3'
services:
validator:
image: validator:latest
volumes:
- ../validator/data:/var/data:delegated
- ../validator/log:/var/log:delegated
stdin_open: true
tty: true
......@@ -4,6 +4,7 @@ set timefmt "%s"
if (!exists("interval")) interval=12
if (!exists("y2height")) y2height=100
if (!exists("yheight")) yheight=200
if (!exists("file")) file="/tmp/miner-chain-stats"
set xrange [time(0) - interval*60*60:time(0)]
set yrange [0:yheight]
......@@ -13,17 +14,17 @@ set y2tics
#set term x11 1 noraise
set term qt noraise
plot "/tmp/miner-chain-stats" using 1:2 with lines title "interval", \
"/tmp/miner-chain-stats" using 1:3 with lines title "txns", \
"/tmp/miner-chain-stats" using 1:4 with lines title "block size in kb", \
"/tmp/miner-chain-stats" using 1:5 with lines title "avg interval", \
"/tmp/miner-chain-stats" using 1:6 with lines title "median interval", \
"/tmp/miner-chain-stats" using 1:7 with lines title "avg txns", \
"/tmp/miner-chain-stats" using 1:9 with lines lw 2 lt rgb "blue" axes x1y2 title "avg election interval", \
"/tmp/miner-chain-stats" using 1:10 with lines lw 2 lt rgb "red" axes x1y2 title "election delay", \
"/tmp/miner-chain-stats" using 1:11 with lines title "100k avg", \
"/tmp/miner-chain-stats" using 1:12 with points pt 7 lt rgb "red" ps 2 axes x1y2 title "delay at election", \
"/tmp/miner-chain-stats" using 1:13 with lines lw 2 lt rgb "orange" axes x1y2 title "HNT production ratio"
plot file using 1:2 with lines title "interval", \
file using 1:3 with lines title "txns", \
file using 1:4 with lines title "block size in kb", \
file using 1:5 with lines title "avg interval", \
file using 1:6 with lines title "median interval", \
file using 1:7 with lines title "avg txns", \
file using 1:9 with lines lw 2 lt rgb "blue" axes x1y2 title "avg election interval", \
file using 1:10 with lines lw 2 lt rgb "red" axes x1y2 title "election delay", \
file using 1:11 with lines title "100k avg", \
file using 1:12 with points pt 7 lt rgb "red" ps 2 axes x1y2 title "delay at election", \
file using 1:13 with lines lw 2 lt rgb "orange" axes x1y2 title "HNT production ratio"
pause 15
reread
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment