eth-probe with fixturenet (#57)

* eth-probe with fixturenet

* Add ability to wait on geth to be up and minting blocks before launching the probe.
This commit is contained in:
Thomas E Lackey 2022-12-06 11:10:38 -06:00 committed by GitHub
parent b538011a7b
commit bd9aaebe3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 111 additions and 2 deletions

View File

@ -14,3 +14,4 @@ cerc/fixturenet-eth-geth
cerc/fixturenet-eth-lighthouse
cerc/watcher-mobymask
cerc/test-container
cerc/eth-probe

View File

@ -12,3 +12,4 @@ fixturenet-laconicd
fixturenet-eth
watcher-mobymask
test
eth-probe

View File

@ -12,3 +12,4 @@ cerc-io/laconic-cns-cli
cerc-io/mobymask-watcher
cerc-io/watcher-ts
vulcanize/assemblyscript
vulcanize/eth-probe

View File

@ -0,0 +1,59 @@
version: '3.2'
services:
eth-probe-db:
restart: always
image: timescale/timescaledb:latest-pg14
environment:
POSTGRES_USER: "probe"
POSTGRES_DB: "probe"
POSTGRES_PASSWORD: "probe"
healthcheck:
test: ["CMD", "nc", "-v", "localhost", "5432"]
interval: 20s
timeout: 5s
retries: 15
start_period: 10s
volumes:
- ../../eth-probe/db/schema.sql:/docker-entrypoint-initdb.d/init.sql
ports:
- 5432
eth-probe-mq:
restart: always
image: cerc/eth-probe:local
environment:
MODE: "mq"
PROBE_DEV: "false"
PGPORT: 5432
PGPASSWORD: "probe"
DB_USER: "probe"
PROBE_DB_NAME: "probe"
PROBE_DB_LOCATION: "eth-probe-db"
MQ_HOST: "0.0.0.0"
MQ_PORT: 33333
DEBUG: "vulcanize:*,cerc:*"
healthcheck:
test: [ "CMD", "nc", "-v", "localhost", "33333" ]
interval: 20s
timeout: 5s
retries: 15
start_period: 10s
depends_on:
eth-probe-db:
condition: service_healthy
eth-probe-probe:
restart: always
image: cerc/eth-probe:local
environment:
MODE: "probe"
PROBE_DEV: "false"
MQ_HOST: "eth-probe-mq"
MQ_PORT: 33333
PROBE_ID: 0
GETH_HOST: "fixturenet-eth-geth-1"
GETH_MIN_BLOCK: 5
GETHJSON_URL: "http://fixturenet-eth-geth-1:9898/geth.json"
DEBUG: "vulcanize:*,cerc:*,-vulcanize:sniffer:dpt:error"
depends_on:
eth-probe-mq:
condition: service_healthy

View File

@ -8,6 +8,9 @@ services:
environment:
RUN_BOOTNODE: "true"
image: cerc/fixturenet-eth-geth:local
ports:
- "9898"
- "30303"
fixturenet-eth-geth-1:
hostname: fixturenet-eth-geth-1

View File

@ -2,6 +2,7 @@
ACCOUNT_PASSWORD=secret1212
# ENODE of the geth bootnode.
BOOTNODE_KEY="b0ac22adcad37213c7c565810a50f1772291e7b0ce53fb73e7ec2a3c75bc13b5"
ENODE="enode://af22c29c316ad069cf48a09a4ad5cf04a251b411e45098888d114c6dd7f489a13786620d5953738762afa13711d4ffb3b19aa5de772d8af72f851f7e9c5b164a@fixturenet-eth-bootnode-geth:30303"
# JWT shared by geth and lighthouse for authentication.

View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
# Build cerc/eth-probe
docker build -t cerc/eth-probe:local ${CERC_REPO_BASE_DIR}/eth-probe

View File

@ -10,6 +10,29 @@ tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX)
envsubst < el-config.yaml > $tmp_dir/genesis-config.yaml
ttd=`cat $tmp_dir/genesis-config.yaml | grep terminal_total_difficulty | awk '{ print $2 }'`
homestead_block=`cat $tmp_dir/genesis-config.yaml | grep homestead_block | awk '{ print $2 }'`
eip150_block=`cat $tmp_dir/genesis-config.yaml | grep eip150_block | awk '{ print $2 }'`
eip155_block=`cat $tmp_dir/genesis-config.yaml | grep eip155_block | awk '{ print $2 }'`
eip158_block=`cat $tmp_dir/genesis-config.yaml | grep eip158_block | awk '{ print $2 }'`
byzantium_block=`cat $tmp_dir/genesis-config.yaml | grep byzantium_block | awk '{ print $2 }'`
constantinople_block=`cat $tmp_dir/genesis-config.yaml | grep constantinople_block | awk '{ print $2 }'`
petersburg_block=`cat $tmp_dir/genesis-config.yaml | grep petersburg_block | awk '{ print $2 }'`
istanbul_block=`cat $tmp_dir/genesis-config.yaml | grep istanbul_block | awk '{ print $2 }'`
berlin_block=`cat $tmp_dir/genesis-config.yaml | grep berlin_block | awk '{ print $2 }'`
london_block=`cat $tmp_dir/genesis-config.yaml | grep london_block | awk '{ print $2 }'`
merge_fork_block=`cat $tmp_dir/genesis-config.yaml | grep merge_fork_block | awk '{ print $2 }'`
python3 /apps/el-gen/genesis_geth.py $tmp_dir/genesis-config.yaml | jq ".config.terminalTotalDifficulty=$ttd" > ../build/el/geth.json
python3 /apps/el-gen/genesis_geth.py $tmp_dir/genesis-config.yaml | \
jq ".config.terminalTotalDifficulty=$ttd" | \
jq ".config.homesteadBlock=$homestead_block" | \
jq ".config.eip150Block=$eip150_block" | \
jq ".config.eip155Block=$eip155_block" | \
jq ".config.eip158Block=$eip158_block" | \
jq ".config.byzantiumBlock=$byzantium_block" | \
jq ".config.constantinopleBlock=$constantinople_block" | \
jq ".config.petersburgBlock=$petersburg_block" | \
jq ".config.istanbulBlock=$istanbul_block" | \
jq ".config.berlinBlock=$berlin_block" | \
jq ".config.londonBlock=$london_block" | \
jq ".config.mergeForkBlock=$merge_fork_block" > ../build/el/geth.json
python3 ../accounts/mnemonic_to_csv.py $tmp_dir/genesis-config.yaml > ../build/el/accounts.csv

View File

@ -11,6 +11,17 @@ chain_id: 1212
deposit_contract_address: "0x1212121212121212121212121212121212121212"
genesis_timestamp: 0
terminal_total_difficulty: 1000
homestead_block: 1
eip150_block: 1
eip155_block: 1
eip158_block: 1
byzantium_block: 1
constantinople_block: 1
petersburg_block: 1
istanbul_block: 1
berlin_block: 1
london_block: 1
merge_fork_block: 1
clique:
enabled: false

View File

@ -4,9 +4,14 @@ ETHERBASE=`cat /opt/testnet/build/el/accounts.csv | head -1 | cut -d',' -f2`
NETWORK_ID=`cat /opt/testnet/el/el-config.yaml | grep 'chain_id' | awk '{ print $2 }'`
NETRESTRICT=`ip addr | grep inet | grep -v '127.0' | awk '{print $2}'`
HOME_DIR=`pwd`
cd /opt/testnet/build/el
python3 -m http.server 9898 &
cd $HOME_DIR
if [ "true" == "$RUN_BOOTNODE" ]; then
geth \
--nodekeyhex="b0ac22adcad37213c7c565810a50f1772291e7b0ce53fb73e7ec2a3c75bc13b5" \
--nodekeyhex="${BOOTNODE_KEY}" \
--nodiscover \
--ipcdisable \
--networkid=${NETWORK_ID} \
@ -49,5 +54,6 @@ else
--syncmode=full \
--mine \
--miner.threads=1 \
--verbosity=5 \
--miner.etherbase="${ETHERBASE}" ${STATEDIFF_OPTS} 2>&1 | tee /var/log/geth.log
fi