Skip to content

Commit

Permalink
#4538: use testnet for verify-range, shorter duration than pubnet
Browse files Browse the repository at this point in the history
  • Loading branch information
sreuland committed Aug 27, 2024
1 parent 659d0e0 commit 6e61306
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 66 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/horizon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ jobs:
run: |
docker build --build-arg="GO_VERSION=$(sed -En 's/^toolchain[[:space:]]+go([[:digit:].]+)$/\1/p' go.mod)" -f services/horizon/docker/verify-range/Dockerfile -t stellar/horizon-verify-range services/horizon/docker/verify-range/
# Use small default range of two most recent checkpoints back from latest archived checkpoint.
docker run -e BRANCH=$(git rev-parse HEAD) -e FROM=10000063 -e TO=10000127 stellar/horizon-verify-range
docker run -e TESTNET=true -e BRANCH=$(git rev-parse HEAD) -e FROM=0 -e TO=0 stellar/horizon-verify-range
# Push image
- if: github.ref == 'refs/heads/master'
Expand Down
2 changes: 1 addition & 1 deletion services/horizon/docker/verify-range/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ ADD dependencies /
RUN ["chmod", "+x", "/dependencies"]
RUN /dependencies

ADD stellar-core.cfg /
ADD captive-core-pubnet.cfg /
ADD captive-core-testnet.cfg /
RUN mkdir -p /cc
RUN mkdir -p /data

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PEER_PORT=11725

NETWORK_PASSPHRASE="Public Global Stellar Network ; September 2015"
FAILURE_SAFETY=1

[[HOME_DOMAINS]]
Expand Down
29 changes: 29 additions & 0 deletions services/horizon/docker/verify-range/captive-core-testnet.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
PEER_PORT=11725
NETWORK_PASSPHRASE="Test SDF Network ; September 2015"
UNSAFE_QUORUM=true
FAILURE_SAFETY=1

[[HOME_DOMAINS]]
HOME_DOMAIN="testnet.stellar.org"
QUALITY="HIGH"

[[VALIDATORS]]
NAME="sdf_testnet_1"
HOME_DOMAIN="testnet.stellar.org"
PUBLIC_KEY="GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y"
ADDRESS="core-testnet1.stellar.org"
HISTORY="curl -sf http://history.stellar.org/prd/core-testnet/core_testnet_001/{0} -o {1}"

[[VALIDATORS]]
NAME="sdf_testnet_2"
HOME_DOMAIN="testnet.stellar.org"
PUBLIC_KEY="GCUCJTIYXSOXKBSNFGNFWW5MUQ54HKRPGJUTQFJ5RQXZXNOLNXYDHRAP"
ADDRESS="core-testnet2.stellar.org"
HISTORY="curl -sf http://history.stellar.org/prd/core-testnet/core_testnet_002/{0} -o {1}"

[[VALIDATORS]]
NAME="sdf_testnet_3"
HOME_DOMAIN="testnet.stellar.org"
PUBLIC_KEY="GC2V2EFSXN6SQTWVYA5EPJPBWWIMSD2XQNKUOHGEKB535AQE2I6IXV2Z"
ADDRESS="core-testnet3.stellar.org"
HISTORY="curl -sf http://history.stellar.org/prd/core-testnet/core_testnet_003/{0} -o {1}"
26 changes: 19 additions & 7 deletions services/horizon/docker/verify-range/start
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
#! /usr/bin/env bash
set -e

# pubnet horizon config
export NETWORK_PASSPHRASE="Public Global Stellar Network ; September 2015"
export HISTORY_ARCHIVE_URLS="https://s3-eu-west-1.amazonaws.com/history.stellar.org/prd/core-live/core_live_001"
if [ -z "${TESTNET}" ]; then
export CAPTIVE_CORE_CONFIG_APPEND_PATH="/captive-core-pubnet.cfg"
export HISTORY_ARCHIVE_URLS="https://s3-eu-west-1.amazonaws.com/history.stellar.org/prd/core-live/core_live_001"
export NETWORK_PASSPHRASE="Public Global Stellar Network ; September 2015"

else
export HISTORY_ARCHIVE_URLS="http://history.stellar.org/prd/core-testnet/core_testnet_001"
export CAPTIVE_CORE_CONFIG_APPEND_PATH="/captive-core-testnet.cfg"
export NETWORK_PASSPHRASE="Test SDF Network ; September 2015"
fi

export DATABASE_URL="postgres://postgres:postgres@localhost:5432/horizon?sslmode=disable"
export CAPTIVE_CORE_CONFIG_APPEND_PATH="/captive-core-pubnet.cfg"
export STELLAR_CORE_BINARY_PATH="/usr/bin/stellar-core"

# configure postgres
Expand All @@ -21,8 +28,13 @@ sudo -u postgres createdb horizon
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';"

if [ $FROM -eq 0 ] && [ $TO -eq 0 ]; then
CURRENTHAS=$(curl -s "$HISTORY_ARCHIVE_URLS/.well-known/stellar-history.json" | jq -r --exit-status 'if .currentLedger < 64 then "0;63" else "\(.currentLedger-64);\(.currentLedger)" end')
IFS=';' read -a RECENTSMALLRANGE <<< "$CURRENTHAS"
echo "obtaining current ledger from archive url $HISTORY_ARCHIVE_URLS"
CURRENTHAS=$(curl -s "$HISTORY_ARCHIVE_URLS/.well-known/stellar-history.json" | jq -sr 'if (. | length) == 0 then null else .[0] end | select( . != null ) | if .currentLedger < 64 then "0;63" else "\(.currentLedger-64);\(.currentLedger)" end' 2> /dev/null)
if [ -z "$CURRENTHAS" ]; then
echo "unable to get current sequence from $HISTORY_ARCHIVE_URLS"
exit 1
fi
IFS=';' read -a RECENTSMALLRANGE <<< "$CURRENTHAS"
FROM=${RECENTSMALLRANGE[0]}
TO=${RECENTSMALLRANGE[1]}
fi
Expand Down Expand Up @@ -140,7 +152,7 @@ function compare() {
fi
}

BASE_BRANCH=${BASE_BRANCH:-horizon-v2.0.0}
BASE_BRANCH=${BASE_BRANCH:-horizon-v2.32.0}

rm -rf /data/compare
mkdir /data/compare
Expand Down
56 changes: 0 additions & 56 deletions services/horizon/docker/verify-range/stellar-core.cfg

This file was deleted.

0 comments on commit 6e61306

Please sign in to comment.