Add Plugeth stack #14
33
.gitea/workflows/test-fixturenet-plugeth.yml
Normal file
33
.gitea/workflows/test-fixturenet-plugeth.yml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
name: Test fixturenet-plugeth
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: '*'
|
||||||
|
|
||||||
|
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
|
@ -1,5 +1,3 @@
|
|||||||
version: '3.7'
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
fixturenet-eth-bootnode-geth:
|
fixturenet-eth-bootnode-geth:
|
||||||
restart: always
|
restart: always
|
||||||
|
132
stack-orchestrator/compose/docker-compose-fixturenet-plugeth.yml
Normal file
132
stack-orchestrator/compose/docker-compose-fixturenet-plugeth.yml
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
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
|
||||||
|
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:
|
19
stack-orchestrator/stacks/fixturenet-plugeth/stack.yml
Normal file
19
stack-orchestrator/stacks/fixturenet-plugeth/stack.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
version: "1.1"
|
||||||
|
name: fixturenet-plugeth
|
||||||
|
description: "Plugeth Ethereum Indexing Fixturenet"
|
||||||
|
repos:
|
||||||
|
- git.vdb.to/cerc-io/plugeth@statediff-patches
|
||||||
|
- git.vdb.to/cerc-io/plugeth-statediff
|
||||||
|
- git.vdb.to/cerc-io/lighthouse
|
||||||
|
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
|
126
tests/fixturenet-plugeth-stack/run-test.sh
Executable file
126
tests/fixturenet-plugeth-stack/run-test.sh
Executable file
@ -0,0 +1,126 @@
|
|||||||
|
#!/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 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
|
||||||
|
|
||||||
|
geth_endpoint=localhost:$($SO_COMMAND deployment --dir $test_deployment_dir ports 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
|
||||||
|
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