Compare commits
No commits in common. "45860f86fccb7c01115a687bfc66f0aaa51484f6" and "9e217e3451ff1fbd00335e1979afd287a9d30f51" have entirely different histories.
45860f86fc
...
9e217e3451
@ -1,37 +0,0 @@
|
||||
name: Ethereum Fixturenet Stack Test
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: '*'
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- ci-test
|
||||
|
||||
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
|
@ -2,4 +2,4 @@
|
||||
|
||||
Experimental external packaging of the Ethereum fixturenet stack.
|
||||
|
||||
[stack documentation](stack-orchestrator/stacks/fixturenet-eth/README.md)
|
||||
[stack documentation](stacks/fixturenet-eth/README.md)
|
||||
|
@ -1,5 +0,0 @@
|
||||
#!/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
|
||||
|
@ -2,7 +2,7 @@
|
||||
services:
|
||||
foundry:
|
||||
restart: always
|
||||
image: ghcr.io/foundry-rs/foundry:latest
|
||||
image: cerc/foundry:local
|
||||
command: ["while :; do sleep 600; done"]
|
||||
volumes:
|
||||
- ../config/foundry/foundry.toml:/foundry.toml
|
||||
|
@ -1,8 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/fixturenet-eth-genesis-premerge
|
||||
|
||||
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-premerge:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} $SCRIPT_DIR
|
8
stack-orchestrator/container-build/cerc-fixturenet-eth-genesis/build.sh
Executable file
8
stack-orchestrator/container-build/cerc-fixturenet-eth-genesis/build.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/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,8 +1,8 @@
|
||||
FROM cerc/fixturenet-eth-genesis-premerge:local as fnetgen
|
||||
FROM ethereum/client-go:release-1.11 as geth
|
||||
FROM cerc/fixturenet-eth-genesis:local as fnetgen
|
||||
FROM cerc/go-ethereum:local 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.21-alpine as delve
|
||||
FROM golang:1.20-alpine as delve
|
||||
RUN go install github.com/go-delve/delve/cmd/dlv@latest
|
||||
|
||||
FROM alpine:3.17
|
||||
|
@ -50,6 +50,58 @@ else
|
||||
|
||||
echo -n "$JWT" > /opt/testnet/build/el/jwtsecret
|
||||
|
||||
if [ "$CERC_RUN_STATEDIFF" == "detect" ] && [ -n "$CERC_STATEDIFF_DB_HOST" ]; then
|
||||
dig_result=$(dig $CERC_STATEDIFF_DB_HOST +short)
|
||||
dig_status_code=$?
|
||||
if [[ $dig_status_code = 0 && -n $dig_result ]]; then
|
||||
echo "Statediff DB at $CERC_STATEDIFF_DB_HOST"
|
||||
CERC_RUN_STATEDIFF="true"
|
||||
else
|
||||
echo "No statediff DB available."
|
||||
CERC_RUN_STATEDIFF="false"
|
||||
fi
|
||||
fi
|
||||
|
||||
STATEDIFF_OPTS=""
|
||||
if [ "$CERC_RUN_STATEDIFF" == "true" ]; then
|
||||
ready=0
|
||||
echo "Waiting for statediff DB..."
|
||||
while [ $ready -eq 0 ]; do
|
||||
sleep 1
|
||||
export PGPASSWORD="$CERC_STATEDIFF_DB_PASSWORD"
|
||||
result=$(psql -h "$CERC_STATEDIFF_DB_HOST" \
|
||||
-p "$CERC_STATEDIFF_DB_PORT" \
|
||||
-U "$CERC_STATEDIFF_DB_USER" \
|
||||
-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..."
|
||||
if [ $result -ge $CERC_STATEDIFF_DB_GOOSE_MIN_VER ]; then
|
||||
ready=1
|
||||
else
|
||||
echo "DB not at required version (want $CERC_STATEDIFF_DB_GOOSE_MIN_VER, have $result)"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
STATEDIFF_OPTS="--statediff \
|
||||
--statediff.db.host=$CERC_STATEDIFF_DB_HOST \
|
||||
--statediff.db.name=$CERC_STATEDIFF_DB_NAME \
|
||||
--statediff.db.nodeid=$CERC_STATEDIFF_DB_NODE_ID \
|
||||
--statediff.db.password=$CERC_STATEDIFF_DB_PASSWORD \
|
||||
--statediff.db.port=$CERC_STATEDIFF_DB_PORT \
|
||||
--statediff.db.user=$CERC_STATEDIFF_DB_USER \
|
||||
--statediff.db.logstatements=${CERC_STATEDIFF_DB_LOG_STATEMENTS:-false} \
|
||||
--statediff.db.copyfrom=${CERC_STATEDIFF_DB_COPY_FROM:-true} \
|
||||
--statediff.waitforsync=true \
|
||||
--statediff.workers=${CERC_STATEDIFF_WORKERS:-1} \
|
||||
--statediff.writing=true"
|
||||
|
||||
if [ -d "${CERC_PLUGINS_DIR}" ]; then
|
||||
# With plugeth, we separate the statediff options by prefixing with ' -- '
|
||||
STATEDIFF_OPTS="--pluginsdir "${CERC_PLUGINS_DIR}" -- ${STATEDIFF_OPTS}"
|
||||
fi
|
||||
fi
|
||||
|
||||
$START_CMD \
|
||||
--datadir="${CERC_ETH_DATADIR}" \
|
||||
--bootnodes="${ENODE}" \
|
||||
@ -57,7 +109,7 @@ else
|
||||
--http \
|
||||
--http.addr="0.0.0.0" \
|
||||
--http.vhosts="*" \
|
||||
--http.api="${CERC_GETH_HTTP_APIS:-eth,web3,net,admin,personal,debug}" \
|
||||
--http.api="${CERC_GETH_HTTP_APIS:-eth,web3,net,admin,personal,debug,statediff}" \
|
||||
--http.corsdomain="*" \
|
||||
--authrpc.addr="0.0.0.0" \
|
||||
--authrpc.vhosts="*" \
|
||||
@ -65,7 +117,7 @@ else
|
||||
--ws \
|
||||
--ws.addr="0.0.0.0" \
|
||||
--ws.origins="*" \
|
||||
--ws.api="${CERC_GETH_WS_APIS:-eth,web3,net,admin,personal,debug}" \
|
||||
--ws.api="${CERC_GETH_WS_APIS:-eth,web3,net,admin,personal,debug,statediff}" \
|
||||
--http.corsdomain="*" \
|
||||
--networkid="${NETWORK_ID}" \
|
||||
--netrestrict="${NETRESTRICT}" \
|
||||
@ -78,8 +130,9 @@ else
|
||||
--metrics \
|
||||
--metrics.addr="0.0.0.0" \
|
||||
--verbosity=${CERC_GETH_VERBOSITY:-3} \
|
||||
--log.vmodule="${CERC_GETH_VMODULE}" \
|
||||
--log.vmodule="${CERC_GETH_VMODULE:-statediff/*=5}" \
|
||||
--miner.etherbase="${ETHERBASE}" \
|
||||
${STATEDIFF_OPTS} \
|
||||
&
|
||||
|
||||
geth_pid=$!
|
||||
|
@ -1,6 +1,6 @@
|
||||
FROM cerc/lighthouse-cli:local AS lcli
|
||||
FROM skylenet/ethereum-genesis-generator@sha256:210353ce7c898686bc5092f16c61220a76d357f51eff9c451e9ad1b9ad03d4d3 AS ethgen
|
||||
FROM cerc/fixturenet-eth-genesis-premerge:local AS fnetgen
|
||||
FROM cerc/fixturenet-eth-genesis:local AS fnetgen
|
||||
|
||||
FROM cerc/lighthouse:local
|
||||
|
||||
|
4
stack-orchestrator/container-build/cerc-go-ethereum/build.sh
Executable file
4
stack-orchestrator/container-build/cerc-go-ethereum/build.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/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
|
@ -2,13 +2,17 @@ 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
|
||||
containers:
|
||||
- cerc/go-ethereum
|
||||
- cerc/lighthouse
|
||||
- cerc/lighthouse-cli
|
||||
- cerc/fixturenet-eth-genesis-premerge
|
||||
- cerc/fixturenet-eth-genesis
|
||||
- cerc/fixturenet-eth-geth
|
||||
- cerc/fixturenet-eth-lighthouse
|
||||
- cerc/foundry
|
||||
pods:
|
||||
- fixturenet-eth
|
||||
- foundry
|
||||
|
@ -1,116 +0,0 @@
|
||||
#!/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
|
Loading…
Reference in New Issue
Block a user