Compare commits
31
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ee4959fd6 | ||
|
|
9540724d82 | ||
|
|
5ad7ebb016 | ||
|
|
ebf19337eb | ||
|
|
7bd725c69f | ||
|
|
40a5fa23cd | ||
|
|
88cdd48588 | ||
|
|
67153e0143 | ||
|
|
4c886dbdd1 | ||
|
|
0d63b95f7d | ||
|
|
f20f91422b | ||
|
|
e1faeb9eca | ||
|
|
af0c6a9143 | ||
|
|
fc8abf7bc4 | ||
|
|
0002a90523 | ||
|
|
4296951f60 | ||
|
|
c4a45b7f04 | ||
|
|
e6f2ec632f | ||
|
|
99ea065389 | ||
|
|
5f7798f392 | ||
|
|
759aeb245f | ||
|
|
270cdd6eb3 | ||
|
|
0430199348 | ||
|
|
897a4bc997 | ||
|
|
4b7b9751fe | ||
|
|
edc2e0756c | ||
|
|
84f9fed18b | ||
|
|
83fb0f92ea | ||
|
|
3587ba33c9 | ||
|
|
e93101e73b | ||
|
|
1472eb2dbe |
@@ -0,0 +1,43 @@
|
||||
name: Publish Ethereum Fixturenet Stack Container Images
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: 'main'
|
||||
paths:
|
||||
- '!**'
|
||||
- '.gitea/workflows/triggers/publish-fixturenet-eth-images'
|
||||
- '.gitea/workflows/publish-fixturenet-eth-images.yml'
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
name: "Publish Ethereum Fixturenet Stack Container Images"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: "Clone project repository"
|
||||
uses: actions/checkout@v3
|
||||
# At present the stock setup-python action fails on Linux/aarch64
|
||||
# Conditional steps below workaroud this by using deadsnakes for that case only
|
||||
- name: "Install Python for ARM on Linux"
|
||||
if: ${{ runner.arch == 'arm64' && runner.os == 'Linux' }}
|
||||
uses: deadsnakes/action@v3.0.1
|
||||
with:
|
||||
python-version: '3.8'
|
||||
- name: "Install Python cases other than ARM on Linux"
|
||||
if: ${{ ! (runner.arch == 'arm64' && runner.os == 'Linux') }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.8'
|
||||
- name: "Print Python version"
|
||||
run: python3 --version
|
||||
- name: "Install stack orchestrator"
|
||||
run: ./scripts/install-so.sh
|
||||
- name: "Build containers"
|
||||
run: |
|
||||
PATH=$PATH:~/bin
|
||||
laconic-so --quiet --stack $(pwd)/stack-orchestrator/stacks/fixturenet-eth setup-repositories
|
||||
laconic-so --stack $(pwd)/stack-orchestrator/stacks/fixturenet-eth build-containers
|
||||
- name: "Publish container images"
|
||||
run: |
|
||||
PATH=$PATH:~/bin
|
||||
echo ${{ secrets.CICD_PUBLISH_TOKEN }} | docker login git.vdb.to -u cerccicd --password-stdin
|
||||
laconic-so --stack $(pwd)/stack-orchestrator/stacks/fixturenet-eth build-containers --publish-images --image-registry git.vdb.to/cerc-io
|
||||
@@ -0,0 +1,35 @@
|
||||
name: Test Ethereum Fixturenet Stack
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: '*'
|
||||
schedule: # Note: coordinate with other tests to not overload runners at the same time of day
|
||||
- cron: '12 01 * * *'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: "Run Ethereum Fixturenet stack test"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: "Clone project repository"
|
||||
uses: actions/checkout@v3
|
||||
# At present the stock setup-python action fails on Linux/aarch64
|
||||
# Conditional steps below workaroud this by using deadsnakes for that case only
|
||||
- name: "Install Python for ARM on Linux"
|
||||
if: ${{ runner.arch == 'arm64' && runner.os == 'Linux' }}
|
||||
uses: deadsnakes/action@v3.0.1
|
||||
with:
|
||||
python-version: '3.8'
|
||||
- name: "Install Python cases other than ARM on Linux"
|
||||
if: ${{ ! (runner.arch == 'arm64' && runner.os == 'Linux') }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.8'
|
||||
- name: "Print Python version"
|
||||
run: python3 --version
|
||||
- name: "Install stack orchestrator"
|
||||
run: ./scripts/install-so.sh
|
||||
- name: "Run stack tests"
|
||||
run: |
|
||||
PATH=$PATH:~/bin
|
||||
./tests/fixturenet-eth-stack/run-test.sh
|
||||
@@ -0,0 +1,35 @@
|
||||
name: Test Ethereum Plugeth Fixturenet Stack
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: '*'
|
||||
schedule: # Note: coordinate with other tests to not overload runners at the same time of day
|
||||
- cron: '14 01 * * *'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: "Test fixturenet-plugeth stack"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: "Clone project repository"
|
||||
uses: actions/checkout@v3
|
||||
# At present the stock setup-python action fails on Linux/aarch64
|
||||
# Conditional steps below workaroud this by using deadsnakes for that case only
|
||||
- name: "Install Python for ARM on Linux"
|
||||
if: ${{ runner.arch == 'arm64' && runner.os == 'Linux' }}
|
||||
uses: deadsnakes/action@v3.0.1
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: "Install Python cases other than ARM on Linux"
|
||||
if: ${{ ! (runner.arch == 'arm64' && runner.os == 'Linux') }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: "Print Python version"
|
||||
run: python3 --version
|
||||
- name: "Install stack orchestrator"
|
||||
run: ./scripts/install-so.sh
|
||||
- name: "Run stack tests"
|
||||
run: |
|
||||
PATH=$PATH:~/bin
|
||||
./tests/fixturenet-plugeth-stack/run-test.sh
|
||||
@@ -0,0 +1,2 @@
|
||||
# Change this file to trigger the job publish-fixturenet-eth-images.yml
|
||||
Trigger
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
Experimental external packaging of the Ethereum fixturenet stack.
|
||||
|
||||
[stack documentation](stacks/fixturenet-eth/README.md)
|
||||
[stack documentation](stack-orchestrator/stacks/fixturenet-eth/README.md)
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
FROM ethpandaops/ethereum-genesis-generator:3.0.0 AS ethgen
|
||||
|
||||
FROM golang:1.20-alpine as builder
|
||||
|
||||
RUN apk add --no-cache python3 py3-pip make bash envsubst jq
|
||||
|
||||
# Install ethereum-genesis-generator tools
|
||||
COPY --from=ethgen /apps /apps
|
||||
RUN cd /apps/el-gen && pip3 install --break-system-packages -r requirements.txt
|
||||
RUN pip3 install --break-system-packages --upgrade "web3==v6.15.1"
|
||||
RUN pip3 install --break-system-packages --upgrade "typing-extensions"
|
||||
|
||||
# Install tool to generate initial block
|
||||
RUN go install github.com/cerc-io/eth-dump-genblock@b29516740fc01cf1d1d623acbfd0e9a2b6440a96
|
||||
|
||||
# Build genesis config
|
||||
COPY genesis /opt/genesis
|
||||
RUN cd /opt/genesis && make genesis-el
|
||||
|
||||
# Snag the genesis block info.
|
||||
RUN eth-dump-genblock /opt/genesis/build/el/geth.json > /opt/genesis/build/el/genesis_block.json
|
||||
|
||||
FROM alpine:latest
|
||||
|
||||
COPY --from=builder /opt/genesis /opt/genesis
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/fixturenet-eth-genesis
|
||||
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
docker build -t cerc/fixturenet-eth-genesis:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} $SCRIPT_DIR
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/go-ethereum
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
docker build -t cerc/go-ethereum:local ${build_command_args} ${CERC_REPO_BASE_DIR}/go-ethereum
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
mkdir ~/bin
|
||||
curl -L -o ~/bin/laconic-so https://git.vdb.to/cerc-io/stack-orchestrator/releases/download/latest/laconic-so
|
||||
chmod +x ~/bin/laconic-so
|
||||
|
||||
+1
-7
@@ -1,5 +1,3 @@
|
||||
version: '3.7'
|
||||
|
||||
services:
|
||||
fixturenet-eth-bootnode-geth:
|
||||
restart: always
|
||||
@@ -22,9 +20,8 @@ services:
|
||||
- SYS_PTRACE
|
||||
environment:
|
||||
CERC_REMOTE_DEBUG: ${CERC_REMOTE_DEBUG:-true}
|
||||
CERC_RUN_STATEDIFF: ${CERC_RUN_STATEDIFF:-detect}
|
||||
CERC_STATEDIFF_DB_NODE_ID: 1
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
CERC_ALLOW_UNPROTECTED_TXS: ${CERC_ALLOW_UNPROTECTED_TXS:-false}
|
||||
env_file:
|
||||
- ../config/fixturenet-eth/fixturenet-eth.env
|
||||
image: cerc/fixturenet-eth-geth:local
|
||||
@@ -62,9 +59,6 @@ services:
|
||||
- fixturenet-eth-bootnode-geth
|
||||
volumes:
|
||||
- fixturenet_eth_geth_2_data:/root/ethdata
|
||||
ports:
|
||||
- "8545"
|
||||
- "8546"
|
||||
|
||||
fixturenet-eth-bootnode-lighthouse:
|
||||
restart: always
|
||||
@@ -0,0 +1,133 @@
|
||||
services:
|
||||
fixturenet-eth-bootnode-geth:
|
||||
restart: always
|
||||
hostname: fixturenet-eth-bootnode-geth
|
||||
env_file:
|
||||
- ../config/fixturenet-eth/fixturenet-eth.env
|
||||
environment:
|
||||
RUN_BOOTNODE: "true"
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
image: cerc/fixturenet-plugeth-plugeth:local
|
||||
volumes:
|
||||
- fixturenet_plugeth_bootnode_geth_data:/root/ethdata
|
||||
ports:
|
||||
- "9898"
|
||||
- "30303"
|
||||
|
||||
fixturenet-eth-geth-1:
|
||||
restart: always
|
||||
hostname: fixturenet-eth-geth-1
|
||||
cap_add:
|
||||
- SYS_PTRACE
|
||||
environment:
|
||||
CERC_REMOTE_DEBUG: ${CERC_REMOTE_DEBUG:-true}
|
||||
CERC_RUN_STATEDIFF: ${CERC_RUN_STATEDIFF:-detect}
|
||||
CERC_STATEDIFF_DB_NODE_ID: 1
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
CERC_ALLOW_UNPROTECTED_TXS: ${CERC_ALLOW_UNPROTECTED_TXS:-false}
|
||||
env_file:
|
||||
- ../config/fixturenet-eth/fixturenet-eth.env
|
||||
- ../config/fixturenet-plugeth/statediff.env
|
||||
image: cerc/fixturenet-plugeth-plugeth:local
|
||||
volumes:
|
||||
- fixturenet_plugeth_geth_1_data:/root/ethdata
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--tries=1", "--connect-timeout=1", "--quiet", "-O", "-", "http://localhost:8545/"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 3s
|
||||
depends_on:
|
||||
- fixturenet-eth-bootnode-geth
|
||||
ports:
|
||||
- "8545"
|
||||
- "8546"
|
||||
- "40000"
|
||||
- "6060"
|
||||
|
||||
fixturenet-eth-geth-2:
|
||||
restart: always
|
||||
hostname: fixturenet-eth-geth-2
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--tries=1", "--connect-timeout=1", "--quiet", "-O", "-", "http://localhost:8545/"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 3s
|
||||
environment:
|
||||
CERC_KEEP_RUNNING_AFTER_GETH_EXIT: "true"
|
||||
env_file:
|
||||
- ../config/fixturenet-eth/fixturenet-eth.env
|
||||
image: cerc/fixturenet-plugeth-plugeth:local
|
||||
depends_on:
|
||||
- fixturenet-eth-bootnode-geth
|
||||
volumes:
|
||||
- fixturenet_plugeth_geth_2_data:/root/ethdata
|
||||
ports:
|
||||
- "8545"
|
||||
- "8546"
|
||||
|
||||
fixturenet-eth-bootnode-lighthouse:
|
||||
restart: always
|
||||
hostname: fixturenet-eth-bootnode-lighthouse
|
||||
environment:
|
||||
RUN_BOOTNODE: "true"
|
||||
image: cerc/fixturenet-eth-lighthouse:local
|
||||
|
||||
fixturenet-eth-lighthouse-1:
|
||||
restart: always
|
||||
hostname: fixturenet-eth-lighthouse-1
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--tries=1", "--connect-timeout=1", "--quiet", "-O", "-", "http://localhost:8001/eth/v2/beacon/blocks/head"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 30s
|
||||
env_file:
|
||||
- ../config/fixturenet-eth/fixturenet-eth.env
|
||||
environment:
|
||||
NODE_NUMBER: "1"
|
||||
ETH1_ENDPOINT: "http://fixturenet-eth-geth-1:8545"
|
||||
EXECUTION_ENDPOINT: "http://fixturenet-eth-geth-1:8551"
|
||||
image: cerc/fixturenet-eth-lighthouse:local
|
||||
volumes:
|
||||
- fixturenet_plugeth_lighthouse_1_data:/opt/testnet/build/cl
|
||||
depends_on:
|
||||
fixturenet-eth-bootnode-lighthouse:
|
||||
condition: service_started
|
||||
fixturenet-eth-geth-1:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- "8001"
|
||||
|
||||
fixturenet-eth-lighthouse-2:
|
||||
restart: always
|
||||
hostname: fixturenet-eth-lighthouse-2
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--tries=1", "--connect-timeout=1", "--quiet", "-O", "-", "http://localhost:8001/eth/v2/beacon/blocks/head"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 30s
|
||||
env_file:
|
||||
- ../config/fixturenet-eth/fixturenet-eth.env
|
||||
environment:
|
||||
NODE_NUMBER: "2"
|
||||
ETH1_ENDPOINT: "http://fixturenet-eth-geth-2:8545"
|
||||
EXECUTION_ENDPOINT: "http://fixturenet-eth-geth-2:8551"
|
||||
LIGHTHOUSE_GENESIS_STATE_URL: "http://fixturenet-eth-lighthouse-1:8001/eth/v2/debug/beacon/states/0"
|
||||
image: cerc/fixturenet-eth-lighthouse:local
|
||||
volumes:
|
||||
- fixturenet_plugeth_lighthouse_2_data:/opt/testnet/build/cl
|
||||
depends_on:
|
||||
fixturenet-eth-bootnode-lighthouse:
|
||||
condition: service_started
|
||||
fixturenet-eth-geth-2:
|
||||
condition: service_healthy
|
||||
|
||||
volumes:
|
||||
fixturenet_plugeth_bootnode_geth_data:
|
||||
fixturenet_plugeth_geth_1_data:
|
||||
fixturenet_plugeth_geth_2_data:
|
||||
fixturenet_plugeth_lighthouse_1_data:
|
||||
fixturenet_plugeth_lighthouse_2_data:
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
services:
|
||||
foundry:
|
||||
restart: always
|
||||
image: cerc/foundry:local
|
||||
image: ghcr.io/foundry-rs/foundry:latest
|
||||
command: ["while :; do sleep 600; done"]
|
||||
volumes:
|
||||
- ../config/foundry/foundry.toml:/foundry.toml
|
||||
@@ -0,0 +1,29 @@
|
||||
services:
|
||||
migrations:
|
||||
restart: on-failure
|
||||
depends_on:
|
||||
ipld-eth-db:
|
||||
condition: service_healthy
|
||||
image: cerc/ipld-eth-db:local
|
||||
environment:
|
||||
DATABASE_USER: "vdbm"
|
||||
DATABASE_NAME: "cerc_testing"
|
||||
DATABASE_PASSWORD: "password"
|
||||
DATABASE_HOSTNAME: "ipld-eth-db"
|
||||
DATABASE_PORT: 5432
|
||||
|
||||
ipld-eth-db:
|
||||
image: timescale/timescaledb:2.8.1-pg14
|
||||
restart: always
|
||||
environment:
|
||||
POSTGRES_USER: "vdbm"
|
||||
POSTGRES_DB: "cerc_testing"
|
||||
POSTGRES_PASSWORD: "password"
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-v", "localhost", "5432"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 3s
|
||||
ports:
|
||||
- "127.0.0.1:8077:5432"
|
||||
@@ -0,0 +1,16 @@
|
||||
services:
|
||||
tx-spammer:
|
||||
restart: always
|
||||
image: cerc/tx-spammer:local
|
||||
env_file:
|
||||
- ../config/tx-spammer/tx-spammer.env
|
||||
environment:
|
||||
ACCOUNTS_CSV_URL: http://fixturenet-eth-bootnode-geth:9898/accounts.csv
|
||||
ETH_HTTP_PATH: http://fixturenet-eth-geth-1:8545
|
||||
LOG_LEVEL: debug
|
||||
SPAMMER_COMMAND: autoSend
|
||||
depends_on:
|
||||
fixturenet-eth-bootnode-geth:
|
||||
condition: service_started
|
||||
fixturenet-eth-geth-1:
|
||||
condition: service_healthy
|
||||
+3
-13
@@ -11,18 +11,8 @@ JWT="0x6cdcac3501046a08e186730dd8bd136cfaf0fdc1fc955f6e15ad3068c0ff2af0"
|
||||
# URL to download the ENR of the lighthouse bootnode (generated at first start).
|
||||
ENR_URL="http://fixturenet-eth-bootnode-lighthouse:3000/bootnode/enr.dat"
|
||||
|
||||
# DB connection settings for statediffing (see docker-compose-db.yml)
|
||||
CERC_STATEDIFF_DB_HOST="ipld-eth-db"
|
||||
CERC_STATEDIFF_DB_PORT=5432
|
||||
CERC_STATEDIFF_DB_NAME="cerc_testing"
|
||||
CERC_STATEDIFF_DB_USER="vdbm"
|
||||
CERC_STATEDIFF_DB_PASSWORD="password"
|
||||
CERC_STATEDIFF_DB_GOOSE_MIN_VER=${CERC_STATEDIFF_DB_GOOSE_MIN_VER:-18}
|
||||
CERC_STATEDIFF_DB_LOG_STATEMENTS="${CERC_STATEDIFF_DB_LOG_STATEMENTS:-false}"
|
||||
CERC_STATEDIFF_WORKERS=2
|
||||
|
||||
CERC_GETH_VMODULE="statediff/*=5,rpc/*=5"
|
||||
CERC_GETH_VMODULE="rpc/*=5"
|
||||
CERC_GETH_VERBOSITY=${CERC_GETH_VERBOSITY:-3}
|
||||
|
||||
# Used by Lighthouse
|
||||
SECONDS_PER_ETH1_BLOCK=${SECONDS_PER_ETH1_BLOCK:-3}
|
||||
# --debug-level
|
||||
DEBUG_LEVEL=${LIGHTHOUSE_DEBUG_LEVEL:-info}
|
||||
@@ -0,0 +1,12 @@
|
||||
# DB connection settings for statediffing (see docker-compose-db.yml)
|
||||
CERC_STATEDIFF_DB_HOST="ipld-eth-db"
|
||||
CERC_STATEDIFF_DB_PORT=5432
|
||||
CERC_STATEDIFF_DB_NAME="cerc_testing"
|
||||
CERC_STATEDIFF_DB_USER="vdbm"
|
||||
CERC_STATEDIFF_DB_PASSWORD="password"
|
||||
CERC_STATEDIFF_DB_GOOSE_MIN_VER=${CERC_STATEDIFF_DB_GOOSE_MIN_VER:-21}
|
||||
CERC_STATEDIFF_DB_LOG_STATEMENTS="${CERC_STATEDIFF_DB_LOG_STATEMENTS:-false}"
|
||||
CERC_STATEDIFF_WORKERS=2
|
||||
|
||||
CERC_GETH_HTTP_APIS="eth,web3,net,admin,personal,debug,statediff"
|
||||
CERC_GETH_WS_APIS="eth,web3,net,admin,personal,debug,statediff"
|
||||
@@ -0,0 +1,2 @@
|
||||
ETH_CALL_FREQ=1000
|
||||
ETH_SEND_FREQ=1000
|
||||
@@ -0,0 +1,17 @@
|
||||
FROM ethpandaops/ethereum-genesis-generator:3.0.0 AS ethgen
|
||||
|
||||
# Build genesis config
|
||||
ADD genesis /opt/genesis
|
||||
RUN cd /opt/genesis && make genesis-el
|
||||
|
||||
FROM golang:1.21-alpine as builder
|
||||
|
||||
COPY --from=ethgen /opt/genesis /opt/genesis
|
||||
|
||||
# Snag the genesis block info.
|
||||
RUN CGO_ENABLED=0 go install github.com/cerc-io/eth-dump-genblock@v0.2.0
|
||||
RUN eth-dump-genblock /opt/genesis/build/el/geth.json > /opt/genesis/build/el/genesis_block.json
|
||||
|
||||
FROM alpine:latest
|
||||
|
||||
COPY --from=builder /opt/genesis /opt/genesis
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/fixturenet-eth-genesis-postmerge
|
||||
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
docker build -t cerc/fixturenet-eth-genesis-postmerge:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} $SCRIPT_DIR
|
||||
+1
-1
@@ -6,7 +6,7 @@ genesis: genesis-el
|
||||
|
||||
.PHONY: genesis-el
|
||||
genesis-el:
|
||||
cd el; ./build_el.sh
|
||||
cd el && . /apps/el-gen/.venv/bin/activate && ./build_el.sh
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
+6
-4
@@ -1,8 +1,8 @@
|
||||
FROM cerc/fixturenet-eth-genesis:local as fnetgen
|
||||
FROM cerc/go-ethereum:local as geth
|
||||
FROM cerc/fixturenet-eth-genesis-postmerge:local as fnetgen
|
||||
FROM ethereum/client-go:release-1.14 as geth
|
||||
|
||||
# Using the same golang image as used to build geth: https://github.com/cerc-io/go-ethereum/blob/HEAD/Dockerfile
|
||||
FROM golang:1.20-alpine as delve
|
||||
FROM golang:1.21-alpine as delve
|
||||
RUN go install github.com/go-delve/delve/cmd/dlv@latest
|
||||
|
||||
FROM alpine:3.17
|
||||
@@ -16,6 +16,8 @@ COPY --from=geth /usr/local/bin/geth /usr/local/bin/
|
||||
COPY --from=fnetgen /opt/genesis /opt/testnet
|
||||
|
||||
# Initialize the geth db with our config
|
||||
RUN geth --datadir ~/ethdata init /opt/testnet/build/el/geth.json && rm -f ~/ethdata/geth/nodekey
|
||||
RUN geth --datadir ~/ethdata --state.scheme hash \
|
||||
init /opt/testnet/build/el/geth.json && \
|
||||
rm -f ~/ethdata/geth/nodekey
|
||||
|
||||
ENTRYPOINT ["/opt/testnet/run.sh"]
|
||||
+8
-8
@@ -75,7 +75,7 @@ else
|
||||
-d "$CERC_STATEDIFF_DB_NAME" \
|
||||
-t -c 'select max(version_id) from goose_db_version;' 2>/dev/null | awk '{ print $1 }')
|
||||
if [ -n "$result" ]; then
|
||||
echo "DB ready..."
|
||||
echo "DB ready."
|
||||
if [ $result -ge $CERC_STATEDIFF_DB_GOOSE_MIN_VER ]; then
|
||||
ready=1
|
||||
else
|
||||
@@ -103,10 +103,9 @@ else
|
||||
fi
|
||||
|
||||
OTHER_OPTS=""
|
||||
# miner options were removed in v1.12
|
||||
GETH_VERSION=$(geth --version | grep -io '[0-9][0-9a-z.-]*')
|
||||
if echo -e "$GETH_VERSION\n1.12" | sort -Vc; then
|
||||
OTHER_OPTS="--miner.threads=1"
|
||||
if [ "$CERC_ALLOW_UNPROTECTED_TXS" == "true" ]; then
|
||||
# Allow for unprotected (non EIP155) txs to be submitted via RPC
|
||||
OTHER_OPTS+=" --rpc.allow-unprotected-txs"
|
||||
fi
|
||||
|
||||
$START_CMD \
|
||||
@@ -116,7 +115,7 @@ else
|
||||
--http \
|
||||
--http.addr="0.0.0.0" \
|
||||
--http.vhosts="*" \
|
||||
--http.api="${CERC_GETH_HTTP_APIS:-eth,web3,net,admin,personal,debug,statediff}" \
|
||||
--http.api="${CERC_GETH_HTTP_APIS:-eth,web3,net,admin,personal,debug}" \
|
||||
--http.corsdomain="*" \
|
||||
--authrpc.addr="0.0.0.0" \
|
||||
--authrpc.vhosts="*" \
|
||||
@@ -124,10 +123,11 @@ else
|
||||
--ws \
|
||||
--ws.addr="0.0.0.0" \
|
||||
--ws.origins="*" \
|
||||
--ws.api="${CERC_GETH_WS_APIS:-eth,web3,net,admin,personal,debug,statediff}" \
|
||||
--ws.api="${CERC_GETH_WS_APIS:-eth,web3,net,admin,personal,debug}" \
|
||||
--http.corsdomain="*" \
|
||||
--networkid="${NETWORK_ID}" \
|
||||
--netrestrict="${NETRESTRICT}" \
|
||||
--state.scheme hash \
|
||||
--gcmode archive \
|
||||
--txlookuplimit=0 \
|
||||
--cache.preimages \
|
||||
@@ -136,7 +136,7 @@ else
|
||||
--metrics \
|
||||
--metrics.addr="0.0.0.0" \
|
||||
--verbosity=${CERC_GETH_VERBOSITY:-3} \
|
||||
--log.vmodule="${CERC_GETH_VMODULE:-statediff/*=5}" \
|
||||
--log.vmodule="${CERC_GETH_VMODULE}" \
|
||||
--miner.etherbase="${ETHERBASE}" \
|
||||
${OTHER_OPTS} \
|
||||
${STATEDIFF_OPTS} \
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
FROM cerc/lighthouse-cli:local AS lcli
|
||||
FROM cerc/fixturenet-eth-genesis:local AS fnetgen
|
||||
FROM cerc/fixturenet-eth-genesis-postmerge:local AS fnetgen
|
||||
|
||||
FROM cerc/lighthouse:local
|
||||
|
||||
+5
@@ -44,6 +44,11 @@ lcli \
|
||||
--interop-genesis-state \
|
||||
--force
|
||||
|
||||
# Patch the spec with settings not supported by lcli
|
||||
sed -i "/^SHARD_COMMITTEE_PERIOD:/s/:.*/: $SHARD_COMMITTEE_PERIOD/" $TESTNET_DIR/config.yaml
|
||||
sed -i "/^MIN_VALIDATOR_WITHDRAWABILITY_DELAY:/s/:.*/: $MIN_VALIDATOR_WITHDRAWABILITY_DELAY/" $TESTNET_DIR/config.yaml
|
||||
sed -i "/^MAX_SEED_LOOKAHEAD:/s/:.*/: $MAX_SEED_LOOKAHEAD/" $TESTNET_DIR/config.yaml
|
||||
|
||||
echo Specification and genesis.ssz generated at $TESTNET_DIR.
|
||||
echo "Generating $VALIDATOR_COUNT validators concurrently... (this may take a while)"
|
||||
|
||||
+8
-2
@@ -38,6 +38,13 @@ SECONDS_PER_SLOT=${SECONDS_PER_SLOT:-3}
|
||||
# Seconds per Eth1 block
|
||||
SECONDS_PER_ETH1_BLOCK=${SECONDS_PER_ETH1_BLOCK:-1}
|
||||
|
||||
# Min epochs between validator activation and exit
|
||||
SHARD_COMMITTEE_PERIOD=2
|
||||
# Min epochs between validator exit and withdrawal
|
||||
MIN_VALIDATOR_WITHDRAWABILITY_DELAY=1
|
||||
# Delay for validator activation/exit
|
||||
MAX_SEED_LOOKAHEAD=1
|
||||
|
||||
# Command line arguments for validator client
|
||||
VC_ARGS=${VC_ARGS:-""}
|
||||
|
||||
@@ -54,5 +61,4 @@ ETH1_DEPOSIT_CONTRACT_ADDRESS=${ETH1_DEPOSIT_CONTRACT_ADDRESS:-`cat $ETH1_CONFIG
|
||||
ETH1_DEPOSIT_CONTRACT_BLOCK=${ETH1_DEPOSIT_CONTRACT_BLOCK:-0x0}
|
||||
SUGGESTED_FEE_RECIPIENT=`cat ../build/el/accounts.csv | head -1 | cut -d',' -f2`
|
||||
|
||||
# --debug-level
|
||||
DEBUG_LEVEL=${LIGHTHOUSE_DEBUG_LEVEL:-debug}
|
||||
VALIDATOR_MNEMONIC="viable ketchup woman library opinion copy rhythm attend rose knock penalty practice photo bundle budget dentist enter round bind holiday useful arch danger lobster"
|
||||
@@ -0,0 +1,27 @@
|
||||
FROM cerc/fixturenet-eth-genesis-postmerge:local as fnetgen
|
||||
|
||||
# Using the same golang image as used to build geth: https://github.com/cerc-io/go-ethereum/blob/HEAD/Dockerfile
|
||||
FROM golang:1.21-alpine as delve
|
||||
RUN go install github.com/go-delve/delve/cmd/dlv@latest
|
||||
|
||||
FROM cerc/plugeth-statediff:local as statediff
|
||||
# FIXME: fork of plugeth, use stock after upstreaming patches
|
||||
FROM cerc/plugeth:local as geth
|
||||
|
||||
FROM alpine:3.18
|
||||
|
||||
RUN apk add --no-cache bash wget python3 bind-tools postgresql-client
|
||||
|
||||
COPY run-el.sh /opt/testnet/run.sh
|
||||
|
||||
COPY --from=delve /go/bin/dlv /usr/local/bin/
|
||||
COPY --from=geth /usr/local/bin/geth /usr/local/bin/
|
||||
COPY --from=fnetgen /opt/genesis /opt/testnet
|
||||
COPY --from=statediff /usr/local/lib/statediff.so /usr/local/lib/plugeth/
|
||||
|
||||
# Initialize the geth db with our config
|
||||
RUN geth --datadir ~/ethdata --state.scheme hash \
|
||||
init /opt/testnet/build/el/geth.json && \
|
||||
rm -f ~/ethdata/geth/nodekey
|
||||
|
||||
ENTRYPOINT ["/opt/testnet/run.sh"]
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/fixturenet-plugeth-plugeth
|
||||
set -x
|
||||
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
cp -fp ${SCRIPT_DIR}/../cerc-fixturenet-eth-geth/run-el.sh ${SCRIPT_DIR}/
|
||||
|
||||
docker build -t cerc/fixturenet-plugeth-plugeth:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} $SCRIPT_DIR
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/plugeth-statediff
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
# Pass Go auth token if present
|
||||
if [[ -n "${CERC_GO_AUTH_TOKEN}" ]]; then
|
||||
build_command_args="${build_command_args} --build-arg GIT_VDBTO_TOKEN=${CERC_GO_AUTH_TOKEN}"
|
||||
fi
|
||||
docker build -t cerc/plugeth-statediff:local ${build_command_args} ${CERC_REPO_BASE_DIR}/plugeth-statediff
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/plugeth
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
# Pass Go auth token if present
|
||||
if [[ -n "${CERC_GO_AUTH_TOKEN}" ]]; then
|
||||
build_command_args="${build_command_args} --build-arg GIT_VDBTO_TOKEN=${CERC_GO_AUTH_TOKEN}"
|
||||
fi
|
||||
docker build -t cerc/plugeth:local ${build_command_args} ${CERC_REPO_BASE_DIR}/plugeth
|
||||
@@ -0,0 +1,16 @@
|
||||
version: "1.1"
|
||||
name: fixturenet-eth-spam
|
||||
description: "Ethereum Fixturenet with tx spam"
|
||||
repos:
|
||||
- git.vdb.to/cerc-io/lighthouse
|
||||
- git.vdb.to/cerc-io/tx-spammer
|
||||
containers:
|
||||
- cerc/lighthouse
|
||||
- cerc/lighthouse-cli
|
||||
- cerc/fixturenet-eth-genesis-postmerge
|
||||
- cerc/fixturenet-eth-geth
|
||||
- cerc/fixturenet-eth-lighthouse
|
||||
- cerc/tx-spammer
|
||||
pods:
|
||||
- fixturenet-eth
|
||||
- tx-spammer
|
||||
@@ -59,60 +59,6 @@ $ laconic-so --stack ~/cerc/fixturenet-eth-stacks/stacks/fixturenet-eth deploy e
|
||||
3
|
||||
```
|
||||
|
||||
## Additional pieces
|
||||
|
||||
Several other containers can used with the basic `fixturenet-eth`:
|
||||
|
||||
* `ipld-eth-db` (enables statediffing)
|
||||
* `ipld-eth-server` (GQL and Ethereum API server, requires `ipld-eth-db`)
|
||||
* `ipld-eth-beacon-db` and `ipld-eth-beacon-indexer` (for indexing Beacon chain blocks)
|
||||
* `eth-probe` (captures eth1 tx gossip)
|
||||
* `keycloak` (nginx proxy with keycloak auth for API authentication)
|
||||
* `tx-spammer` (generates and sends automated transactions to the fixturenet)
|
||||
|
||||
It is not necessary to use them all at once, but a complete example follows:
|
||||
|
||||
```
|
||||
# Setup
|
||||
$ laconic-so setup-repositories --include git.vdb.to/cerc-io/go-ethereum,git.vdb.to/cerc-io/ipld-eth-db,git.vdb.to/cerc-io/ipld-eth-server,github.com/cerc-io/ipld-eth-beacon-db,github.com/cerc-io/ipld-eth-beacon-indexer,github.com/cerc-io/eth-probe,git.vdb.to/cerc-io/tx-spammer
|
||||
|
||||
# Build
|
||||
$ laconic-so build-containers --include cerc/go-ethereum,cerc/lighthouse,cerc/fixturenet-eth-geth,cerc/fixturenet-eth-lighthouse,cerc/ipld-eth-db,cerc/ipld-eth-server,cerc/ipld-eth-beacon-db,cerc/ipld-eth-beacon-indexer,cerc/eth-probe,cerc/keycloak,cerc/tx-spammer
|
||||
|
||||
# Deploy
|
||||
$ laconic-so deploy-system --include db,fixturenet-eth,ipld-eth-server,ipld-eth-beacon-db,ipld-eth-beacon-indexer,eth-probe,keycloak,tx-spammer up
|
||||
|
||||
# Status
|
||||
|
||||
$ container-build/cerc-fixturenet-eth-lighthouse/scripts/status.sh
|
||||
Waiting for geth to generate DAG.... done
|
||||
Waiting for beacon phase0.... done
|
||||
Waiting for beacon altair.... done
|
||||
Waiting for beacon bellatrix pre-merge.... done
|
||||
Waiting for beacon bellatrix merge.... done
|
||||
|
||||
$ docker ps -f 'name=laconic' --format 'table {{.Names}}\t{{.Ports}}' | cut -d'-' -f3- | sort
|
||||
NAMES PORTS
|
||||
eth-probe-db-1 0.0.0.0:55849->5432/tcp
|
||||
eth-probe-mq-1
|
||||
eth-probe-probe-1
|
||||
fixturenet-eth-bootnode-geth-1 8545-8546/tcp, 30303/udp, 0.0.0.0:55847->9898/tcp, 0.0.0.0:55848->30303/tcp
|
||||
fixturenet-eth-bootnode-lighthouse-1
|
||||
fixturenet-eth-geth-1-1 8546/tcp, 30303/tcp, 30303/udp, 0.0.0.0:55851->8545/tcp
|
||||
fixturenet-eth-geth-2-1 8545-8546/tcp, 30303/tcp, 30303/udp
|
||||
fixturenet-eth-lighthouse-1-1 0.0.0.0:55858->8001/tcp
|
||||
fixturenet-eth-lighthouse-2-1
|
||||
ipld-eth-beacon-db-1 127.0.0.1:8076->5432/tcp
|
||||
ipld-eth-beacon-indexer-1
|
||||
ipld-eth-db-1 127.0.0.1:8077->5432/tcp
|
||||
ipld-eth-server-1 127.0.0.1:8081-8082->8081-8082/tcp
|
||||
keycloak-1 8443/tcp, 0.0.0.0:55857->8080/tcp
|
||||
keycloak-db-1 0.0.0.0:55850->5432/tcp
|
||||
keycloak-nginx-1 0.0.0.0:55859->80/tcp
|
||||
migrations-1
|
||||
tx-spammer-1
|
||||
```
|
||||
|
||||
## Clean up
|
||||
|
||||
Stop all services running in the background:
|
||||
+2
-6
@@ -2,17 +2,13 @@ version: "1.1"
|
||||
name: fixturenet-eth
|
||||
description: "Ethereum Fixturenet"
|
||||
repos:
|
||||
- git.vdb.to/cerc-io/go-ethereum@v1.11.6-statediff-v5
|
||||
- git.vdb.to/cerc-io/lighthouse
|
||||
- github.com/dboreham/foundry
|
||||
- git.vdb.to/cerc-io/lighthouse@testnet-genesis-eth1-withdrawal-creds
|
||||
containers:
|
||||
- cerc/go-ethereum
|
||||
- cerc/lighthouse
|
||||
- cerc/lighthouse-cli
|
||||
- cerc/fixturenet-eth-genesis
|
||||
- cerc/fixturenet-eth-genesis-postmerge
|
||||
- cerc/fixturenet-eth-geth
|
||||
- cerc/fixturenet-eth-lighthouse
|
||||
- cerc/foundry
|
||||
pods:
|
||||
- fixturenet-eth
|
||||
- foundry
|
||||
@@ -0,0 +1,20 @@
|
||||
version: "1.1"
|
||||
name: fixturenet-plugeth
|
||||
description: "Plugeth Ethereum Indexing Fixturenet"
|
||||
repos:
|
||||
- git.vdb.to/cerc-io/plugeth@statediff
|
||||
- git.vdb.to/cerc-io/plugeth-statediff
|
||||
- git.vdb.to/cerc-io/lighthouse@testnet-genesis-eth1-withdrawal-creds
|
||||
- git.vdb.to/cerc-io/ipld-eth-db
|
||||
containers:
|
||||
- cerc/plugeth-statediff
|
||||
- cerc/plugeth
|
||||
- cerc/fixturenet-eth-genesis-postmerge
|
||||
- cerc/fixturenet-plugeth-plugeth
|
||||
- cerc/lighthouse
|
||||
- cerc/lighthouse-cli
|
||||
- cerc/fixturenet-eth-lighthouse
|
||||
- cerc/ipld-eth-db
|
||||
pods:
|
||||
- fixturenet-plugeth
|
||||
- ipld-eth-db
|
||||
Executable
+116
@@ -0,0 +1,116 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
SO_COMMAND=laconic-so
|
||||
|
||||
test_name="Fixturenet eth stack deploy test"
|
||||
echo "Running ${test_name}"
|
||||
|
||||
stack_name=$(pwd)/stack-orchestrator/stacks/fixturenet-eth
|
||||
|
||||
test_fail_exit () {
|
||||
local fail_message=$1
|
||||
echo "${test_name}: ${fail_message}"
|
||||
echo "${test_name}: FAILED"
|
||||
exit 1
|
||||
}
|
||||
|
||||
log_info () {
|
||||
local message=$1
|
||||
echo "$(date +"%Y-%m-%d %T"): ${message}"
|
||||
}
|
||||
|
||||
# Sanity check the stack dir exists
|
||||
if [ ! -d "${stack_name}" ]; then
|
||||
test_fail_exit "stack directory not present"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Set a non-default repo dir
|
||||
export CERC_REPO_BASE_DIR=~/stack-orchestrator-test/repo-base-dir
|
||||
reported_version_string=$( $SO_COMMAND version )
|
||||
echo "SO version is: ${reported_version_string}"
|
||||
echo "Cloning repositories into: $CERC_REPO_BASE_DIR"
|
||||
rm -rf $CERC_REPO_BASE_DIR
|
||||
mkdir -p $CERC_REPO_BASE_DIR
|
||||
|
||||
$SO_COMMAND --stack ${stack_name} setup-repositories
|
||||
|
||||
echo "Building containers"
|
||||
$SO_COMMAND --stack ${stack_name} build-containers
|
||||
|
||||
test_deployment_dir=$CERC_REPO_BASE_DIR/test-deployment-dir
|
||||
test_deployment_spec=$CERC_REPO_BASE_DIR/test-deployment-spec.yml
|
||||
|
||||
$SO_COMMAND --stack ${stack_name} deploy init --output $test_deployment_spec
|
||||
# Check the file now exists
|
||||
if [ ! -f "$test_deployment_spec" ]; then
|
||||
test_fail_exit "deploy init test: spec fille not present"
|
||||
fi
|
||||
echo "deploy init test: passed"
|
||||
|
||||
$SO_COMMAND --stack ${stack_name} deploy create --spec-file $test_deployment_spec --deployment-dir $test_deployment_dir
|
||||
# Check the deployment dir exists
|
||||
if [ ! -d "$test_deployment_dir" ]; then
|
||||
test_fail_exit "deploy create test: deployment directory not present"
|
||||
fi
|
||||
echo "deploy create test: passed"
|
||||
|
||||
$SO_COMMAND deployment --dir $test_deployment_dir start
|
||||
|
||||
timeout=900 # 15 minutes
|
||||
log_info "Getting initial block number. Timeout set to $timeout seconds"
|
||||
start_time=$(date +%s)
|
||||
elapsed_time=0
|
||||
initial_block_number=0
|
||||
while [ "$initial_block_number" -eq 0 ] && [ $elapsed_time -lt $timeout ]; do
|
||||
sleep 10
|
||||
log_info "Waiting for initial block..."
|
||||
initial_block_number=$($SO_COMMAND deployment --dir $test_deployment_dir exec foundry "cast block-number")
|
||||
current_time=$(date +%s)
|
||||
elapsed_time=$((current_time - start_time))
|
||||
done
|
||||
|
||||
subsequent_block_number=$initial_block_number
|
||||
|
||||
# if initial block was 0 after timeout, assume chain did not start successfully and skip finding subsequent block
|
||||
if [[ $initial_block_number -gt 0 ]]; then
|
||||
timeout=300
|
||||
log_info "Getting subsequent block number. Timeout set to $timeout seconds"
|
||||
start_time=$(date +%s)
|
||||
elapsed_time=0
|
||||
# wait for 5 blocks or timeout
|
||||
while [ "$subsequent_block_number" -le $((initial_block_number + 5)) ] && [ $elapsed_time -lt $timeout ]; do
|
||||
sleep 10
|
||||
log_info "Waiting for five blocks or $timeout seconds..."
|
||||
subsequent_block_number=$($SO_COMMAND deployment --dir $test_deployment_dir exec foundry "cast block-number")
|
||||
current_time=$(date +%s)
|
||||
elapsed_time=$((current_time - start_time))
|
||||
done
|
||||
fi
|
||||
|
||||
# will return 0 if either of the above loops timed out
|
||||
block_number_difference=$((subsequent_block_number - initial_block_number))
|
||||
|
||||
log_info "Results of block height queries:"
|
||||
echo "Initial block height: $initial_block_number"
|
||||
echo "Subsequent block height: $subsequent_block_number"
|
||||
|
||||
# Block height difference should be between 1 and some small number
|
||||
if [[ $block_number_difference -gt 1 && $block_number_difference -lt 100 ]]; then
|
||||
echo "Test passed"
|
||||
test_result=0
|
||||
else
|
||||
echo "Test failed: block numbers were ${initial_block_number} and ${subsequent_block_number}"
|
||||
echo "Logs from stack:"
|
||||
$SO_COMMAND deployment --dir $test_deployment_dir logs
|
||||
test_result=1
|
||||
fi
|
||||
$SO_COMMAND deployment --dir $test_deployment_dir stop --delete-volumes
|
||||
log_info "Removing cloned repositories"
|
||||
rm -rf $CERC_REPO_BASE_DIR
|
||||
log_info "Test finished"
|
||||
exit $test_result
|
||||
Executable
+132
@@ -0,0 +1,132 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
SO_COMMAND=laconic-so
|
||||
|
||||
test_name="Fixturenet eth stack deploy test"
|
||||
echo "Running ${test_name}"
|
||||
|
||||
stack_name=$(pwd)/stack-orchestrator/stacks/fixturenet-plugeth
|
||||
|
||||
test_fail_exit () {
|
||||
local fail_message=$1
|
||||
echo "${test_name}: ${fail_message}"
|
||||
echo "${test_name}: FAILED"
|
||||
exit 1
|
||||
}
|
||||
|
||||
log_info () {
|
||||
local message=$1
|
||||
echo "$(date +"%Y-%m-%d %T"): ${message}"
|
||||
}
|
||||
|
||||
get_block_number () {
|
||||
local result=$(wget -q -O- "$1" \
|
||||
--header "Content-Type: application/json" \
|
||||
--post-data '{"id": 1, "jsonrpc": "2.0", "method": "eth_blockNumber"}' | \
|
||||
jq -r '.result')
|
||||
printf "%d" $result
|
||||
}
|
||||
|
||||
# Sanity check the stack dir exists
|
||||
if [ ! -d "${stack_name}" ]; then
|
||||
test_fail_exit "stack directory not present"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Set a non-default repo dir
|
||||
export CERC_REPO_BASE_DIR=~/stack-orchestrator-test/repo-base-dir
|
||||
reported_version_string=$( $SO_COMMAND version )
|
||||
echo "SO version is: ${reported_version_string}"
|
||||
echo "Cloning repositories into: $CERC_REPO_BASE_DIR"
|
||||
rm -rf $CERC_REPO_BASE_DIR
|
||||
mkdir -p $CERC_REPO_BASE_DIR
|
||||
|
||||
$SO_COMMAND --stack ${stack_name} setup-repositories
|
||||
|
||||
echo "Building containers"
|
||||
$SO_COMMAND --stack ${stack_name} build-containers
|
||||
|
||||
test_deployment_dir=$CERC_REPO_BASE_DIR/test-deployment-dir
|
||||
test_deployment_spec=$CERC_REPO_BASE_DIR/test-deployment-spec.yml
|
||||
|
||||
$SO_COMMAND --stack ${stack_name} deploy init --output $test_deployment_spec
|
||||
# Check the file now exists
|
||||
if [ ! -f "$test_deployment_spec" ]; then
|
||||
test_fail_exit "deploy init test: spec file not present"
|
||||
fi
|
||||
echo "deploy init test: passed"
|
||||
|
||||
$SO_COMMAND --stack ${stack_name} deploy create --spec-file $test_deployment_spec --deployment-dir $test_deployment_dir
|
||||
# Check the deployment dir exists
|
||||
if [ ! -d "$test_deployment_dir" ]; then
|
||||
test_fail_exit "deploy create test: deployment directory not present"
|
||||
fi
|
||||
echo "deploy create test: passed"
|
||||
|
||||
dump_logs () {
|
||||
echo "Test failed. Logs from stack:"
|
||||
$SO_COMMAND deployment --dir $test_deployment_dir logs
|
||||
}
|
||||
trap dump_logs ERR
|
||||
|
||||
$SO_COMMAND deployment --dir $test_deployment_dir start
|
||||
|
||||
geth_endpoint=localhost:$($SO_COMMAND deployment --dir $test_deployment_dir port fixturenet-eth-geth-1 8545 | cut -d: -f2)
|
||||
|
||||
timeout=900 # 15 minutes
|
||||
log_info "Getting initial block number. Timeout set to $timeout seconds"
|
||||
start_time=$(date +%s)
|
||||
elapsed_time=0
|
||||
initial_block_number=0
|
||||
while [ "$initial_block_number" -eq 0 ] && [ $elapsed_time -lt $timeout ]; do
|
||||
sleep 10
|
||||
log_info "Waiting for initial block..."
|
||||
initial_block_number=$(get_block_number $geth_endpoint)
|
||||
current_time=$(date +%s)
|
||||
elapsed_time=$((current_time - start_time))
|
||||
done
|
||||
|
||||
subsequent_block_number=$initial_block_number
|
||||
|
||||
# if initial block was 0 after timeout, assume chain did not start successfully and skip finding subsequent block
|
||||
if [[ $initial_block_number -gt 0 ]]; then
|
||||
timeout=300
|
||||
log_info "Getting subsequent block number. Timeout set to $timeout seconds"
|
||||
start_time=$(date +%s)
|
||||
elapsed_time=0
|
||||
# wait for 5 blocks or timeout
|
||||
while [ "$subsequent_block_number" -le $((initial_block_number + 5)) ] && [ $elapsed_time -lt $timeout ]; do
|
||||
sleep 10
|
||||
log_info "Waiting for five blocks or $timeout seconds..."
|
||||
subsequent_block_number=$(get_block_number $geth_endpoint)
|
||||
current_time=$(date +%s)
|
||||
elapsed_time=$((current_time - start_time))
|
||||
done
|
||||
fi
|
||||
|
||||
# will return 0 if either of the above loops timed out
|
||||
block_number_difference=$((subsequent_block_number - initial_block_number))
|
||||
|
||||
log_info "Results of block height queries:"
|
||||
echo "Initial block height: $initial_block_number"
|
||||
echo "Subsequent block height: $subsequent_block_number"
|
||||
|
||||
# Block height difference should be between 1 and some small number
|
||||
[[ $block_number_difference -gt 1 && $block_number_difference -lt 100 ]]
|
||||
|
||||
# Check that the block hash is present in the ipld-eth-db
|
||||
echo "Querying ipld-eth-db for block number $subsequent_block_number"
|
||||
block_hash_query="SELECT block_hash from eth.header_cids where block_number = $subsequent_block_number"
|
||||
block_hash=$(
|
||||
$SO_COMMAND deployment --dir $test_deployment_dir exec ipld-eth-db \
|
||||
"psql -qtA -U vdbm -c '$block_hash_query' cerc_testing"
|
||||
)
|
||||
echo "Block hash in ipld-eth-db: $block_hash"
|
||||
|
||||
[[ -n $block_hash ]]
|
||||
|
||||
echo "Test passed."
|
||||
Reference in New Issue
Block a user