From 6e61306623187ec5d32a6b60bbf0f5662c273720 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 27 Aug 2024 14:41:03 -0700 Subject: [PATCH] #4538: use testnet for verify-range, shorter duration than pubnet --- .github/workflows/horizon.yml | 2 +- .../horizon/docker/verify-range/Dockerfile | 2 +- .../verify-range/captive-core-pubnet.cfg | 2 +- .../verify-range/captive-core-testnet.cfg | 29 ++++++++++ services/horizon/docker/verify-range/start | 26 ++++++--- .../docker/verify-range/stellar-core.cfg | 56 ------------------- 6 files changed, 51 insertions(+), 66 deletions(-) create mode 100644 services/horizon/docker/verify-range/captive-core-testnet.cfg delete mode 100644 services/horizon/docker/verify-range/stellar-core.cfg diff --git a/.github/workflows/horizon.yml b/.github/workflows/horizon.yml index 60e485d96a..c64a5b6716 100644 --- a/.github/workflows/horizon.yml +++ b/.github/workflows/horizon.yml @@ -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' diff --git a/services/horizon/docker/verify-range/Dockerfile b/services/horizon/docker/verify-range/Dockerfile index 6323870f38..eaa5d9274d 100644 --- a/services/horizon/docker/verify-range/Dockerfile +++ b/services/horizon/docker/verify-range/Dockerfile @@ -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 diff --git a/services/horizon/docker/verify-range/captive-core-pubnet.cfg b/services/horizon/docker/verify-range/captive-core-pubnet.cfg index 5a702711fe..171a50358f 100644 --- a/services/horizon/docker/verify-range/captive-core-pubnet.cfg +++ b/services/horizon/docker/verify-range/captive-core-pubnet.cfg @@ -1,5 +1,5 @@ PEER_PORT=11725 - +NETWORK_PASSPHRASE="Public Global Stellar Network ; September 2015" FAILURE_SAFETY=1 [[HOME_DOMAINS]] diff --git a/services/horizon/docker/verify-range/captive-core-testnet.cfg b/services/horizon/docker/verify-range/captive-core-testnet.cfg new file mode 100644 index 0000000000..018f413dea --- /dev/null +++ b/services/horizon/docker/verify-range/captive-core-testnet.cfg @@ -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}" \ No newline at end of file diff --git a/services/horizon/docker/verify-range/start b/services/horizon/docker/verify-range/start index 768297a524..a81342e27b 100644 --- a/services/horizon/docker/verify-range/start +++ b/services/horizon/docker/verify-range/start @@ -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 @@ -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 @@ -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 diff --git a/services/horizon/docker/verify-range/stellar-core.cfg b/services/horizon/docker/verify-range/stellar-core.cfg deleted file mode 100644 index 6139f9f528..0000000000 --- a/services/horizon/docker/verify-range/stellar-core.cfg +++ /dev/null @@ -1,56 +0,0 @@ -AUTOMATIC_MAINTENANCE_PERIOD=0 -PUBLIC_HTTP_PORT=true -LOG_FILE_PATH="" -NETWORK_PASSPHRASE="Public Global Stellar Network ; September 2015" -CATCHUP_RECENT=100 - -AUTOMATIC_MAINTENANCE_COUNT=0 - -NODE_NAMES=[ -"GAOO3LWBC4XF6VWRP5ESJ6IBHAISVJMSBTALHOQM2EZG7Q477UWA6L7U eno", -"GAXP5DW4CVCW2BJNPFGTWCEGZTJKTNWFQQBE5SCWNJIJ54BOHR3WQC3W moni", -"GBFZFQRGOPQC5OEAWO76NOY6LBRLUNH4I5QYPUYAK53QSQWVTQ2D4FT5 dzham", -"GDXWQCSKVYAJSUGR2HBYVFVR7NA7YWYSYK3XYKKFO553OQGOHAUP2PX2 jianing", -"GCJCSMSPIWKKPR7WEPIQG63PDF7JGGEENRC33OKVBSPUDIRL6ZZ5M7OO tempo.eu.com", -"GCCW4H2DKAC7YYW62H3ZBDRRE5KXRLYLI4T5QOSO6EAMUOE37ICSKKRJ sparrow_tw", -"GD5DJQDDBKGAYNEAXU562HYGOOSYAEOO6AS53PZXBOZGCP5M2OPGMZV3 fuxi.lab", -"GBGGNBZVYNMVLCWNQRO7ASU6XX2MRPITAGLASRWOWLB4ZIIPHMGNMC4I huang.lab", -"GDPJ4DPPFEIP2YTSQNOKT7NMLPKU2FFVOEIJMG36RCMBWBUR4GTXLL57 nezha.lab", -"GCDLFPQ76D6YUSCUECLKI3AFEVXFWVRY2RZH2YQNYII35FDECWUGV24T SnT.Lux", -"GBAR4OY6T6M4P344IF5II5DNWHVUJU7OLQPSMG2FWVJAFF642BX5E3GB telindus", -# non validating -"GCGB2S2KGYARPVIA37HYZXVRM2YZUEXA6S33ZU5BUDC6THSB62LZSTYH sdf_watcher1", -"GCM6QMP3DLRPTAZW2UZPCPX2LF3SXWXKPMP3GKFZBDSF3QZGV2G5QSTK sdf_watcher2", -"GABMKJM6I25XI4K7U6XWMULOUQIQ27BCTMLS6BYYSOWKTBUXVRJSXHYQ sdf_watcher3", -# seem down -"GB6REF5GOGGSEHZ3L2YK6K4T4KX3YDMWHDCPMV7MZJDLHBDNZXEPRBGM donovan", -"GBGR22MRCIVW2UZHFXMY5UIBJGPYABPQXQ5GGMNCSUM2KHE3N6CNH6G5 nelisky1", -"GA2DE5AQF32LU5OZ5OKAFGPA2DLW4H6JHPGYJUVTNS3W7N2YZCTQFFV6 nelisky2", -"GDJ73EX25GGUVMUBCK6DPSTJLYP3IC7I3H2URLXJQ5YP56BW756OUHIG w00kie", -"GAM7A32QZF5PJASRSGVFPAB36WWTHCBHO5CHG3WUFTUQPT7NZX3ONJU4 ptarasov" -] - -KNOWN_PEERS=[ -"core-live-a.stellar.org:11625", -"core-live-b.stellar.org:11625", -"core-live-c.stellar.org:11625", -"confucius.strllar.org", -"stellar1.bitventure.co", -"stellar.256kw.com"] - -UNSAFE_QUORUM=true - -[QUORUM_SET] -VALIDATORS=[ -"$sdf_watcher1","$sdf_watcher2","$sdf_watcher3" -] - -# Stellar.org history store -[HISTORY.sdf1] -get="curl -sf http://s3-eu-west-1.amazonaws.com/history.stellar.org/prd/core-live/core_live_001/{0} -o {1}" - -[HISTORY.sdf2] -get="curl -sf http://s3-eu-west-1.amazonaws.com/history.stellar.org/prd/core-live/core_live_002/{0} -o {1}" - -[HISTORY.sdf3] -get="curl -sf http://s3-eu-west-1.amazonaws.com/history.stellar.org/prd/core-live/core_live_003/{0} -o {1}"