From d4bed8d6f57194f6c1c005906ff1d83c58e186f4 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Wed, 19 Jun 2024 01:06:03 +0800 Subject: [PATCH 01/24] geth state.scheme=hash --- .../container-build/cerc-fixturenet-eth-geth/Dockerfile | 4 +++- .../container-build/cerc-fixturenet-eth-geth/run-el.sh | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/stack-orchestrator/container-build/cerc-fixturenet-eth-geth/Dockerfile b/stack-orchestrator/container-build/cerc-fixturenet-eth-geth/Dockerfile index 3afb524..cecbe3d 100644 --- a/stack-orchestrator/container-build/cerc-fixturenet-eth-geth/Dockerfile +++ b/stack-orchestrator/container-build/cerc-fixturenet-eth-geth/Dockerfile @@ -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"] diff --git a/stack-orchestrator/container-build/cerc-fixturenet-eth-geth/run-el.sh b/stack-orchestrator/container-build/cerc-fixturenet-eth-geth/run-el.sh index 86224b0..f074131 100755 --- a/stack-orchestrator/container-build/cerc-fixturenet-eth-geth/run-el.sh +++ b/stack-orchestrator/container-build/cerc-fixturenet-eth-geth/run-el.sh @@ -75,6 +75,7 @@ else --http.corsdomain="*" \ --networkid="${NETWORK_ID}" \ --netrestrict="${NETRESTRICT}" \ + --state.scheme hash \ --gcmode archive \ --txlookuplimit=0 \ --cache.preimages \ -- 2.45.2 From 2e56cf9d181c3a7a9b82ab9d38ae4b5c7db58438 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Fri, 21 Jun 2024 17:11:22 +0800 Subject: [PATCH 02/24] add fixturenet-plugeth stack --- .gitea/workflows/test-fixturenet-plugeth.yml | 33 +++++ .../compose/docker-compose-fixturenet-eth.yml | 2 - .../docker-compose-fixturenet-plugeth.yml | 132 ++++++++++++++++++ .../stacks/fixturenet-plugeth/stack.yml | 19 +++ tests/fixturenet-plugeth-stack/run-test.sh | 126 +++++++++++++++++ 5 files changed, 310 insertions(+), 2 deletions(-) create mode 100644 .gitea/workflows/test-fixturenet-plugeth.yml create mode 100644 stack-orchestrator/compose/docker-compose-fixturenet-plugeth.yml create mode 100644 stack-orchestrator/stacks/fixturenet-plugeth/stack.yml create mode 100755 tests/fixturenet-plugeth-stack/run-test.sh diff --git a/.gitea/workflows/test-fixturenet-plugeth.yml b/.gitea/workflows/test-fixturenet-plugeth.yml new file mode 100644 index 0000000..d8cc11d --- /dev/null +++ b/.gitea/workflows/test-fixturenet-plugeth.yml @@ -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 diff --git a/stack-orchestrator/compose/docker-compose-fixturenet-eth.yml b/stack-orchestrator/compose/docker-compose-fixturenet-eth.yml index 38110a7..348617b 100644 --- a/stack-orchestrator/compose/docker-compose-fixturenet-eth.yml +++ b/stack-orchestrator/compose/docker-compose-fixturenet-eth.yml @@ -1,5 +1,3 @@ -version: '3.7' - services: fixturenet-eth-bootnode-geth: restart: always diff --git a/stack-orchestrator/compose/docker-compose-fixturenet-plugeth.yml b/stack-orchestrator/compose/docker-compose-fixturenet-plugeth.yml new file mode 100644 index 0000000..df84edb --- /dev/null +++ b/stack-orchestrator/compose/docker-compose-fixturenet-plugeth.yml @@ -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: diff --git a/stack-orchestrator/stacks/fixturenet-plugeth/stack.yml b/stack-orchestrator/stacks/fixturenet-plugeth/stack.yml new file mode 100644 index 0000000..e76adf2 --- /dev/null +++ b/stack-orchestrator/stacks/fixturenet-plugeth/stack.yml @@ -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 diff --git a/tests/fixturenet-plugeth-stack/run-test.sh b/tests/fixturenet-plugeth-stack/run-test.sh new file mode 100755 index 0000000..19853c2 --- /dev/null +++ b/tests/fixturenet-plugeth-stack/run-test.sh @@ -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 -- 2.45.2 From a3060bf1c1ec52fc9bd934dc83ca8bd2a42b438e Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Sun, 23 Jun 2024 18:06:59 +0800 Subject: [PATCH 03/24] add ipld-eth-db --- .../compose/docker-compose-ipld-eth-db.yml | 29 +++++++++++++++++++ .../container-build/cerc-ipld-eth-db/build.sh | 4 +++ 2 files changed, 33 insertions(+) create mode 100644 stack-orchestrator/compose/docker-compose-ipld-eth-db.yml create mode 100755 stack-orchestrator/container-build/cerc-ipld-eth-db/build.sh diff --git a/stack-orchestrator/compose/docker-compose-ipld-eth-db.yml b/stack-orchestrator/compose/docker-compose-ipld-eth-db.yml new file mode 100644 index 0000000..ada1d95 --- /dev/null +++ b/stack-orchestrator/compose/docker-compose-ipld-eth-db.yml @@ -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" diff --git a/stack-orchestrator/container-build/cerc-ipld-eth-db/build.sh b/stack-orchestrator/container-build/cerc-ipld-eth-db/build.sh new file mode 100755 index 0000000..d454f3f --- /dev/null +++ b/stack-orchestrator/container-build/cerc-ipld-eth-db/build.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +# Build cerc/ipld-eth-db +source ${CERC_CONTAINER_BASE_DIR}/build-base.sh +docker build -t cerc/ipld-eth-db:local ${build_command_args} ${CERC_REPO_BASE_DIR}/ipld-eth-db -- 2.45.2 From 80228a5e04722f632d66eaf53aa2f5186e4f0c84 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Mon, 24 Jun 2024 22:12:12 +0800 Subject: [PATCH 04/24] [dev] use patched SO --- .gitea/workflows/test-fixturenet-plugeth.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/test-fixturenet-plugeth.yml b/.gitea/workflows/test-fixturenet-plugeth.yml index d8cc11d..a1e15c9 100644 --- a/.gitea/workflows/test-fixturenet-plugeth.yml +++ b/.gitea/workflows/test-fixturenet-plugeth.yml @@ -26,7 +26,15 @@ jobs: - name: "Print Python version" run: python3 --version - name: "Install stack orchestrator" - run: ./scripts/install-so.sh + # FIXME: merge SO fixes and revert + # run: ./scripts/install-so.sh + uses: actions/checkout@v3 + with: + repository: cerc-io/stack-orchestrator + ref: roysc/fix-various + path: .tools/stack-orchestrator + - name: "Install stack orchestrator" + run: pip3 install .tools/stack-orchestrator - name: "Run stack tests" run: | PATH=$PATH:~/bin -- 2.45.2 From 849bb0a4f18a649fc766551442d707aef6673d58 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Tue, 25 Jun 2024 01:07:45 +0800 Subject: [PATCH 05/24] fix command --- tests/fixturenet-plugeth-stack/run-test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fixturenet-plugeth-stack/run-test.sh b/tests/fixturenet-plugeth-stack/run-test.sh index 19853c2..aa64861 100755 --- a/tests/fixturenet-plugeth-stack/run-test.sh +++ b/tests/fixturenet-plugeth-stack/run-test.sh @@ -69,7 +69,7 @@ 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) +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" -- 2.45.2 From 709b048d5a3989370aa4210795dd15ad347a5a66 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Tue, 25 Jun 2024 01:56:05 +0800 Subject: [PATCH 06/24] add missing files --- .../Dockerfile | 25 +++++++++++++++++++ .../cerc-fixturenet-plugeth-plugeth/build.sh | 13 ++++++++++ .../cerc-plugeth-statediff/build.sh | 8 ++++++ .../container-build/cerc-plugeth/build.sh | 8 ++++++ 4 files changed, 54 insertions(+) create mode 100644 stack-orchestrator/container-build/cerc-fixturenet-plugeth-plugeth/Dockerfile create mode 100755 stack-orchestrator/container-build/cerc-fixturenet-plugeth-plugeth/build.sh create mode 100755 stack-orchestrator/container-build/cerc-plugeth-statediff/build.sh create mode 100755 stack-orchestrator/container-build/cerc-plugeth/build.sh diff --git a/stack-orchestrator/container-build/cerc-fixturenet-plugeth-plugeth/Dockerfile b/stack-orchestrator/container-build/cerc-fixturenet-plugeth-plugeth/Dockerfile new file mode 100644 index 0000000..5ae55af --- /dev/null +++ b/stack-orchestrator/container-build/cerc-fixturenet-plugeth-plugeth/Dockerfile @@ -0,0 +1,25 @@ +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.17 + +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 init /opt/testnet/build/el/geth.json && rm -f ~/ethdata/geth/nodekey + +ENTRYPOINT ["/opt/testnet/run.sh"] diff --git a/stack-orchestrator/container-build/cerc-fixturenet-plugeth-plugeth/build.sh b/stack-orchestrator/container-build/cerc-fixturenet-plugeth-plugeth/build.sh new file mode 100755 index 0000000..6074ed1 --- /dev/null +++ b/stack-orchestrator/container-build/cerc-fixturenet-plugeth-plugeth/build.sh @@ -0,0 +1,13 @@ +#!/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 ) + +if [ ! -e "${SCRIPT_DIR}/run-el.sh" ]; then + cp -fp ${SCRIPT_DIR}/../cerc-fixturenet-eth-geth/run-el.sh ${SCRIPT_DIR}/ +fi + +docker build -t cerc/fixturenet-plugeth-plugeth:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} $SCRIPT_DIR diff --git a/stack-orchestrator/container-build/cerc-plugeth-statediff/build.sh b/stack-orchestrator/container-build/cerc-plugeth-statediff/build.sh new file mode 100755 index 0000000..447c8d0 --- /dev/null +++ b/stack-orchestrator/container-build/cerc-plugeth-statediff/build.sh @@ -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 diff --git a/stack-orchestrator/container-build/cerc-plugeth/build.sh b/stack-orchestrator/container-build/cerc-plugeth/build.sh new file mode 100755 index 0000000..cd98c5c --- /dev/null +++ b/stack-orchestrator/container-build/cerc-plugeth/build.sh @@ -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 -- 2.45.2 From 20671b54564521e65a4b8d990cccb013e4a2c65f Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Tue, 25 Jun 2024 15:09:03 +0800 Subject: [PATCH 07/24] consistent test name --- .gitea/workflows/test-fixturenet-plugeth.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/test-fixturenet-plugeth.yml b/.gitea/workflows/test-fixturenet-plugeth.yml index a1e15c9..e9bd6a6 100644 --- a/.gitea/workflows/test-fixturenet-plugeth.yml +++ b/.gitea/workflows/test-fixturenet-plugeth.yml @@ -1,4 +1,4 @@ -name: Test fixturenet-plugeth +name: Test Ethereum Plugeth Fixturenet Stack on: push: -- 2.45.2 From 5e0172a1d6f8c417e83a1ae53282302fa2e25a7b Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Tue, 25 Jun 2024 15:14:17 +0800 Subject: [PATCH 08/24] missing repo ref --- stack-orchestrator/stacks/fixturenet-plugeth/stack.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/stack-orchestrator/stacks/fixturenet-plugeth/stack.yml b/stack-orchestrator/stacks/fixturenet-plugeth/stack.yml index e76adf2..42fb618 100644 --- a/stack-orchestrator/stacks/fixturenet-plugeth/stack.yml +++ b/stack-orchestrator/stacks/fixturenet-plugeth/stack.yml @@ -5,6 +5,7 @@ repos: - git.vdb.to/cerc-io/plugeth@statediff-patches - git.vdb.to/cerc-io/plugeth-statediff - git.vdb.to/cerc-io/lighthouse + - git.vdb.to/cerc-io/ipld-eth-db containers: - cerc/plugeth-statediff - cerc/plugeth -- 2.45.2 From 2fdf11643bf065a9d1fe55bc965e7f83ee515075 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Wed, 26 Jun 2024 13:58:50 +0800 Subject: [PATCH 09/24] correct plugeth ref --- stack-orchestrator/stacks/fixturenet-plugeth/stack.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack-orchestrator/stacks/fixturenet-plugeth/stack.yml b/stack-orchestrator/stacks/fixturenet-plugeth/stack.yml index 42fb618..ef1119f 100644 --- a/stack-orchestrator/stacks/fixturenet-plugeth/stack.yml +++ b/stack-orchestrator/stacks/fixturenet-plugeth/stack.yml @@ -2,7 +2,7 @@ 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/plugeth-statediff - git.vdb.to/cerc-io/lighthouse - git.vdb.to/cerc-io/ipld-eth-db -- 2.45.2 From 15bc89129984b814dc2a59b115264ec6218f09f7 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Wed, 26 Jun 2024 19:19:36 +0800 Subject: [PATCH 10/24] add statediff config --- .../docker-compose-fixturenet-plugeth.yml | 1 + .../config/fixturenet-eth/statediff.env | 9 ++++ .../cerc-fixturenet-eth-geth/run-el.sh | 53 +++++++++++++++++++ .../cerc-fixturenet-plugeth-plugeth/build.sh | 4 +- 4 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 stack-orchestrator/config/fixturenet-eth/statediff.env diff --git a/stack-orchestrator/compose/docker-compose-fixturenet-plugeth.yml b/stack-orchestrator/compose/docker-compose-fixturenet-plugeth.yml index df84edb..88cc25c 100644 --- a/stack-orchestrator/compose/docker-compose-fixturenet-plugeth.yml +++ b/stack-orchestrator/compose/docker-compose-fixturenet-plugeth.yml @@ -27,6 +27,7 @@ services: CERC_ALLOW_UNPROTECTED_TXS: ${CERC_ALLOW_UNPROTECTED_TXS:-false} env_file: - ../config/fixturenet-eth/fixturenet-eth.env + - ../config/fixturenet-eth/statediff.env image: cerc/fixturenet-plugeth-plugeth:local volumes: - fixturenet_plugeth_geth_1_data:/root/ethdata diff --git a/stack-orchestrator/config/fixturenet-eth/statediff.env b/stack-orchestrator/config/fixturenet-eth/statediff.env new file mode 100644 index 0000000..b3f14cf --- /dev/null +++ b/stack-orchestrator/config/fixturenet-eth/statediff.env @@ -0,0 +1,9 @@ +# 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 diff --git a/stack-orchestrator/container-build/cerc-fixturenet-eth-geth/run-el.sh b/stack-orchestrator/container-build/cerc-fixturenet-eth-geth/run-el.sh index f074131..2de950d 100755 --- a/stack-orchestrator/container-build/cerc-fixturenet-eth-geth/run-el.sh +++ b/stack-orchestrator/container-build/cerc-fixturenet-eth-geth/run-el.sh @@ -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 + OTHER_OPTS="" if [ "$CERC_ALLOW_UNPROTECTED_TXS" == "true" ]; then # Allow for unprotected (non EIP155) txs to be submitted via RPC @@ -87,6 +139,7 @@ else --log.vmodule="${CERC_GETH_VMODULE}" \ --miner.etherbase="${ETHERBASE}" \ ${OTHER_OPTS} \ + ${STATEDIFF_OPTS} \ & geth_pid=$! diff --git a/stack-orchestrator/container-build/cerc-fixturenet-plugeth-plugeth/build.sh b/stack-orchestrator/container-build/cerc-fixturenet-plugeth-plugeth/build.sh index 6074ed1..53c0226 100755 --- a/stack-orchestrator/container-build/cerc-fixturenet-plugeth-plugeth/build.sh +++ b/stack-orchestrator/container-build/cerc-fixturenet-plugeth-plugeth/build.sh @@ -6,8 +6,6 @@ source ${CERC_CONTAINER_BASE_DIR}/build-base.sh SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -if [ ! -e "${SCRIPT_DIR}/run-el.sh" ]; then - cp -fp ${SCRIPT_DIR}/../cerc-fixturenet-eth-geth/run-el.sh ${SCRIPT_DIR}/ -fi +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 -- 2.45.2 From 7f9a8ff6645ec701f6aafc327945745fc5c1dc72 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Wed, 26 Jun 2024 20:03:20 +0800 Subject: [PATCH 11/24] update eth-dump-genblock --- .../cerc-fixturenet-eth-genesis-postmerge/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack-orchestrator/container-build/cerc-fixturenet-eth-genesis-postmerge/Dockerfile b/stack-orchestrator/container-build/cerc-fixturenet-eth-genesis-postmerge/Dockerfile index 870e8c9..87e5fa9 100644 --- a/stack-orchestrator/container-build/cerc-fixturenet-eth-genesis-postmerge/Dockerfile +++ b/stack-orchestrator/container-build/cerc-fixturenet-eth-genesis-postmerge/Dockerfile @@ -11,7 +11,7 @@ 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 +RUN go install github.com/cerc-io/eth-dump-genblock@v0.2.0 # Build genesis config COPY genesis /opt/genesis -- 2.45.2 From 66435eb60c87b8a767061b2b5f50919791446352 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Wed, 26 Jun 2024 21:38:42 +0800 Subject: [PATCH 12/24] bump alpine --- .../container-build/cerc-fixturenet-plugeth-plugeth/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack-orchestrator/container-build/cerc-fixturenet-plugeth-plugeth/Dockerfile b/stack-orchestrator/container-build/cerc-fixturenet-plugeth-plugeth/Dockerfile index 5ae55af..1ca8e1f 100644 --- a/stack-orchestrator/container-build/cerc-fixturenet-plugeth-plugeth/Dockerfile +++ b/stack-orchestrator/container-build/cerc-fixturenet-plugeth-plugeth/Dockerfile @@ -8,7 +8,7 @@ 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.17 +FROM alpine:3.18 RUN apk add --no-cache bash wget python3 bind-tools postgresql-client -- 2.45.2 From e20ad560d035e00966224fa680cdb65d2ad44f18 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Wed, 26 Jun 2024 22:00:38 +0800 Subject: [PATCH 13/24] check ipld-eth-db in test --- tests/fixturenet-plugeth-stack/run-test.sh | 36 +++++++++++++--------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/tests/fixturenet-plugeth-stack/run-test.sh b/tests/fixturenet-plugeth-stack/run-test.sh index aa64861..a197735 100755 --- a/tests/fixturenet-plugeth-stack/run-test.sh +++ b/tests/fixturenet-plugeth-stack/run-test.sh @@ -56,7 +56,7 @@ 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" + test_fail_exit "deploy init test: spec file not present" fi echo "deploy init test: passed" @@ -109,18 +109,24 @@ 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:" +dump_logs () { + echo "Test failed. 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 +} +trap dump_logs ERR + +# 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." -- 2.45.2 From d23db36129f51dd6849249c983c46d03e88b932d Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Thu, 27 Jun 2024 17:02:47 +0800 Subject: [PATCH 14/24] update goose min db version --- stack-orchestrator/config/fixturenet-eth/statediff.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack-orchestrator/config/fixturenet-eth/statediff.env b/stack-orchestrator/config/fixturenet-eth/statediff.env index b3f14cf..6a3621c 100644 --- a/stack-orchestrator/config/fixturenet-eth/statediff.env +++ b/stack-orchestrator/config/fixturenet-eth/statediff.env @@ -4,6 +4,6 @@ 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_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 -- 2.45.2 From 36b829a55270492679604a7cd148ebe292d29189 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Thu, 27 Jun 2024 17:33:54 +0800 Subject: [PATCH 15/24] use go 1.21 image --- .../cerc-fixturenet-eth-genesis-postmerge/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack-orchestrator/container-build/cerc-fixturenet-eth-genesis-postmerge/Dockerfile b/stack-orchestrator/container-build/cerc-fixturenet-eth-genesis-postmerge/Dockerfile index 87e5fa9..8832924 100644 --- a/stack-orchestrator/container-build/cerc-fixturenet-eth-genesis-postmerge/Dockerfile +++ b/stack-orchestrator/container-build/cerc-fixturenet-eth-genesis-postmerge/Dockerfile @@ -1,6 +1,6 @@ FROM ethpandaops/ethereum-genesis-generator:3.0.0 AS ethgen -FROM golang:1.20-alpine as builder +FROM golang:1.21-alpine as builder RUN apk add --no-cache python3 py3-pip make bash envsubst jq -- 2.45.2 From 7d5770ac9e625744eafc324046361e042d0efb5c Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Thu, 27 Jun 2024 19:23:17 +0800 Subject: [PATCH 16/24] cerc-fixturenet-eth-genesis-postmerge/Dockerfile: add gcc, no cgo --- .../cerc-fixturenet-eth-genesis-postmerge/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stack-orchestrator/container-build/cerc-fixturenet-eth-genesis-postmerge/Dockerfile b/stack-orchestrator/container-build/cerc-fixturenet-eth-genesis-postmerge/Dockerfile index 8832924..59b917a 100644 --- a/stack-orchestrator/container-build/cerc-fixturenet-eth-genesis-postmerge/Dockerfile +++ b/stack-orchestrator/container-build/cerc-fixturenet-eth-genesis-postmerge/Dockerfile @@ -2,16 +2,16 @@ FROM ethpandaops/ethereum-genesis-generator:3.0.0 AS ethgen FROM golang:1.21-alpine as builder -RUN apk add --no-cache python3 py3-pip make bash envsubst jq +RUN apk add --no-cache python3 py3-pip make bash envsubst jq gcc # 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 "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@v0.2.0 +RUN CGO_ENABLED=0 go install github.com/cerc-io/eth-dump-genblock@v0.2.0 # Build genesis config COPY genesis /opt/genesis -- 2.45.2 From a64c29ac34b8927bae36f856d1e7dc39bab1c628 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Thu, 27 Jun 2024 20:34:11 +0800 Subject: [PATCH 17/24] simplify genesis image --- .../Dockerfile | 20 ++++++------------- .../genesis/Makefile | 2 +- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/stack-orchestrator/container-build/cerc-fixturenet-eth-genesis-postmerge/Dockerfile b/stack-orchestrator/container-build/cerc-fixturenet-eth-genesis-postmerge/Dockerfile index 59b917a..caabc93 100644 --- a/stack-orchestrator/container-build/cerc-fixturenet-eth-genesis-postmerge/Dockerfile +++ b/stack-orchestrator/container-build/cerc-fixturenet-eth-genesis-postmerge/Dockerfile @@ -1,23 +1,15 @@ 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 -RUN apk add --no-cache python3 py3-pip make bash envsubst jq gcc - -# 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 CGO_ENABLED=0 go install github.com/cerc-io/eth-dump-genblock@v0.2.0 - -# Build genesis config -COPY genesis /opt/genesis -RUN cd /opt/genesis && make genesis-el +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 diff --git a/stack-orchestrator/container-build/cerc-fixturenet-eth-genesis-postmerge/genesis/Makefile b/stack-orchestrator/container-build/cerc-fixturenet-eth-genesis-postmerge/genesis/Makefile index a1eef57..be5a877 100644 --- a/stack-orchestrator/container-build/cerc-fixturenet-eth-genesis-postmerge/genesis/Makefile +++ b/stack-orchestrator/container-build/cerc-fixturenet-eth-genesis-postmerge/genesis/Makefile @@ -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: -- 2.45.2 From c51064af1779b21d0848aba038ca48d127fedd0e Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Thu, 27 Jun 2024 20:51:05 +0800 Subject: [PATCH 18/24] plugeth state.scheme = hash --- .../cerc-fixturenet-plugeth-plugeth/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stack-orchestrator/container-build/cerc-fixturenet-plugeth-plugeth/Dockerfile b/stack-orchestrator/container-build/cerc-fixturenet-plugeth-plugeth/Dockerfile index 1ca8e1f..212e35d 100644 --- a/stack-orchestrator/container-build/cerc-fixturenet-plugeth-plugeth/Dockerfile +++ b/stack-orchestrator/container-build/cerc-fixturenet-plugeth-plugeth/Dockerfile @@ -20,6 +20,8 @@ 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 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"] -- 2.45.2 From 69457f83c3ab5070feb6c50258358537c3d1a677 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Thu, 27 Jun 2024 21:13:38 +0800 Subject: [PATCH 19/24] dump logs on stack failure --- tests/fixturenet-plugeth-stack/run-test.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/fixturenet-plugeth-stack/run-test.sh b/tests/fixturenet-plugeth-stack/run-test.sh index a197735..0a1ebc0 100755 --- a/tests/fixturenet-plugeth-stack/run-test.sh +++ b/tests/fixturenet-plugeth-stack/run-test.sh @@ -67,6 +67,12 @@ if [ ! -d "$test_deployment_dir" ]; then 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) @@ -109,12 +115,6 @@ log_info "Results of block height queries:" echo "Initial block height: $initial_block_number" echo "Subsequent block height: $subsequent_block_number" -dump_logs () { - echo "Test failed. Logs from stack:" - $SO_COMMAND deployment --dir $test_deployment_dir logs -} -trap dump_logs ERR - # Block height difference should be between 1 and some small number [[ $block_number_difference -gt 1 && $block_number_difference -lt 100 ]] -- 2.45.2 From 8edc4a0da609413c038d9de7b48acdee649268e3 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Mon, 1 Jul 2024 16:54:50 +0800 Subject: [PATCH 20/24] cron for plugeth test --- .gitea/workflows/test-fixturenet-plugeth.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitea/workflows/test-fixturenet-plugeth.yml b/.gitea/workflows/test-fixturenet-plugeth.yml index e9bd6a6..071a433 100644 --- a/.gitea/workflows/test-fixturenet-plugeth.yml +++ b/.gitea/workflows/test-fixturenet-plugeth.yml @@ -3,6 +3,8 @@ 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: -- 2.45.2 From e14f7966ba445719c58dea4d7c35483c5059a05d Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Mon, 1 Jul 2024 19:19:08 +0800 Subject: [PATCH 21/24] add slack job failure notification --- .gitea/workflows/test-fixturenet-plugeth.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.gitea/workflows/test-fixturenet-plugeth.yml b/.gitea/workflows/test-fixturenet-plugeth.yml index 071a433..b49d2aa 100644 --- a/.gitea/workflows/test-fixturenet-plugeth.yml +++ b/.gitea/workflows/test-fixturenet-plugeth.yml @@ -41,3 +41,20 @@ jobs: run: | PATH=$PATH:~/bin ./tests/fixturenet-plugeth-stack/run-test.sh + + - name: Notify Vulcanize Slack on CI failure + if: ${{ always() && github.ref_name == 'main' }} + uses: ravsamhq/notify-slack-action@v2 + with: + status: ${{ job.status }} + notify_when: 'failure' + env: + SLACK_WEBHOOK_URL: ${{ secrets.VULCANIZE_SLACK_CI_ALERTS }} + - name: Notify DeepStack Slack on CI failure + if: ${{ always() && github.ref_name == 'main' }} + uses: ravsamhq/notify-slack-action@v2 + with: + status: ${{ job.status }} + notify_when: 'failure' + env: + SLACK_WEBHOOK_URL: ${{ secrets.DEEPSTACK_SLACK_CI_ALERTS }} -- 2.45.2 From dc9571bb07089789b4f3b999852e9c24c352ba3d Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Tue, 2 Jul 2024 21:20:15 +0800 Subject: [PATCH 22/24] rm build script for ipld-eth-db prefer default build --- stack-orchestrator/container-build/cerc-ipld-eth-db/build.sh | 4 ---- 1 file changed, 4 deletions(-) delete mode 100755 stack-orchestrator/container-build/cerc-ipld-eth-db/build.sh diff --git a/stack-orchestrator/container-build/cerc-ipld-eth-db/build.sh b/stack-orchestrator/container-build/cerc-ipld-eth-db/build.sh deleted file mode 100755 index d454f3f..0000000 --- a/stack-orchestrator/container-build/cerc-ipld-eth-db/build.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -# Build cerc/ipld-eth-db -source ${CERC_CONTAINER_BASE_DIR}/build-base.sh -docker build -t cerc/ipld-eth-db:local ${build_command_args} ${CERC_REPO_BASE_DIR}/ipld-eth-db -- 2.45.2 From b907467b6cb7f59eb998c35185a249d395bda70e Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Tue, 9 Jul 2024 23:45:24 +0800 Subject: [PATCH 23/24] update SO ref --- .gitea/workflows/test-fixturenet-plugeth.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.gitea/workflows/test-fixturenet-plugeth.yml b/.gitea/workflows/test-fixturenet-plugeth.yml index b49d2aa..59e0472 100644 --- a/.gitea/workflows/test-fixturenet-plugeth.yml +++ b/.gitea/workflows/test-fixturenet-plugeth.yml @@ -28,15 +28,7 @@ jobs: - name: "Print Python version" run: python3 --version - name: "Install stack orchestrator" - # FIXME: merge SO fixes and revert - # run: ./scripts/install-so.sh - uses: actions/checkout@v3 - with: - repository: cerc-io/stack-orchestrator - ref: roysc/fix-various - path: .tools/stack-orchestrator - - name: "Install stack orchestrator" - run: pip3 install .tools/stack-orchestrator + run: ./scripts/install-so.sh - name: "Run stack tests" run: | PATH=$PATH:~/bin -- 2.45.2 From bd6feac3d9e425af50ab760b6d4af9fbc1c05999 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Tue, 9 Jul 2024 23:45:38 +0800 Subject: [PATCH 24/24] rm slack notification --- .gitea/workflows/test-fixturenet-plugeth.yml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/.gitea/workflows/test-fixturenet-plugeth.yml b/.gitea/workflows/test-fixturenet-plugeth.yml index 59e0472..462b8e8 100644 --- a/.gitea/workflows/test-fixturenet-plugeth.yml +++ b/.gitea/workflows/test-fixturenet-plugeth.yml @@ -33,20 +33,3 @@ jobs: run: | PATH=$PATH:~/bin ./tests/fixturenet-plugeth-stack/run-test.sh - - - name: Notify Vulcanize Slack on CI failure - if: ${{ always() && github.ref_name == 'main' }} - uses: ravsamhq/notify-slack-action@v2 - with: - status: ${{ job.status }} - notify_when: 'failure' - env: - SLACK_WEBHOOK_URL: ${{ secrets.VULCANIZE_SLACK_CI_ALERTS }} - - name: Notify DeepStack Slack on CI failure - if: ${{ always() && github.ref_name == 'main' }} - uses: ravsamhq/notify-slack-action@v2 - with: - status: ${{ job.status }} - notify_when: 'failure' - env: - SLACK_WEBHOOK_URL: ${{ secrets.DEEPSTACK_SLACK_CI_ALERTS }} -- 2.45.2