Skip to content

Commit

Permalink
dynamically ingest TESTING_SOROBAN_HIGH_LIMIT_OVERRIDE to standalone …
Browse files Browse the repository at this point in the history
…network
  • Loading branch information
tsachiherman committed Sep 18, 2023
1 parent b02e35e commit 92dfb1e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
1 change: 0 additions & 1 deletion standalone/core/etc/stellar-core.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ PUBLIC_HTTP_PORT=true
RUN_STANDALONE=__RUN_STANDALONE__
MANUAL_CLOSE=__MANUAL_CLOSE__
ARTIFICIALLY_ACCELERATE_TIME_FOR_TESTING=true
TESTING_SOROBAN_HIGH_LIMIT_OVERRIDE=true

NETWORK_PASSPHRASE="__NETWORK__"
KNOWN_CURSORS=["HORIZON"]
Expand Down
1 change: 0 additions & 1 deletion standalone/horizon/etc/stellar-captive-core.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ PUBLIC_HTTP_PORT=false
PEER_PORT=11725
DATABASE="__DATABASE__"
ARTIFICIALLY_ACCELERATE_TIME_FOR_TESTING=true
TESTING_SOROBAN_HIGH_LIMIT_OVERRIDE=true

UNSAFE_QUORUM=true
FAILURE_SAFETY=0
Expand Down
1 change: 0 additions & 1 deletion standalone/soroban-rpc/etc/stellar-captive-core.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ PUBLIC_HTTP_PORT=false
PEER_PORT=11726
DATABASE="__DATABASE__"
ARTIFICIALLY_ACCELERATE_TIME_FOR_TESTING=true
TESTING_SOROBAN_HIGH_LIMIT_OVERRIDE=true
ENABLE_SOROBAN_DIAGNOSTIC_EVENTS=__ENABLE_SOROBAN_DIAGNOSTIC_EVENTS__

EXPERIMENTAL_BUCKETLIST_DB=true
Expand Down
29 changes: 27 additions & 2 deletions start
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export PGPORT=5432

QUICKSTART_INITIALIZED=false
CURRENT_POSTGRES_PID=""
# CORE_PROTOCOL_VERSION is default to 19, and will be updated in find_core_version.
CORE_PROTOCOL_VERSION=19

function main() {
process_args $*
Expand Down Expand Up @@ -69,6 +71,7 @@ function start() {
echo "mode: $STELLAR_MODE"
echo "network: $NETWORK ($NETWORK_PASSPHRASE)"

find_core_version
copy_defaults
init_db
init_stellar_core
Expand All @@ -82,6 +85,14 @@ function start() {
exec_supervisor
}

function find_core_version() {
PROTOCOL_20_CORE=$(stellar-core version 2> /dev/null | grep "ledger protocol version: 20" | wc -l | tr -d ' ')
if [ "$PROTOCOL_20_CORE" = "1" ]; then
# we're on protocol 20.
CORE_PROTOCOL_VERSION=20
fi
}

function process_args() {
while [[ -n "$1" ]]; do
ARG="$1"
Expand Down Expand Up @@ -338,7 +349,6 @@ function init_stellar_core() {

if [ "$NETWORK" = "standalone" ]; then
start_postgres

run_silent "init-core-scp" sudo -u stellar stellar-core force-scp --conf $COREHOME/etc/stellar-core.cfg
fi

Expand All @@ -356,6 +366,11 @@ function init_stellar_core() {
run_silent "finalize-core-config-run-standalone" perl -pi -e "s/__RUN_STANDALONE__/$RUN_STANDALONE/g" etc/stellar-core.cfg
run_silent "finalize-core-config-manual-close" perl -pi -e "s/__MANUAL_CLOSE__/$ENABLE_CORE_MANUAL_CLOSE/g" etc/stellar-core.cfg

if [ "$NETWORK" = "standalone" ] && [ "${CORE_PROTOCOL_VERSION}" = "20" ]; then
echo "\n" >> $COREHOME/etc/stellar-core.cfg
echo "TESTING_SOROBAN_HIGH_LIMIT_OVERRIDE=true\n" >> $COREHOME/etc/stellar-core.cfg
fi

start_postgres

run_silent "init-core-db" sudo -u stellar stellar-core new-db --conf etc/stellar-core.cfg
Expand Down Expand Up @@ -392,6 +407,11 @@ function init_horizon() {
run_silent "finalize-horizon-captivecore-db" perl -pi -e "s*__DATABASE__*sqlite3://$HZHOME/captive-core/stellar.db*g" $HORIZON_CAPTIVE_CORE_CFG
perl -pi -e "s/__NETWORK__/$NETWORK_PASSPHRASE/g" $HORIZON_CAPTIVE_CORE_CFG

if [ "$NETWORK" = "standalone" ] && [ "${CORE_PROTOCOL_VERSION}" = "20" ]; then
echo "\n" >> ${HORIZON_CAPTIVE_CORE_CFG}
echo "TESTING_SOROBAN_HIGH_LIMIT_OVERRIDE=true\n" >> ${HORIZON_CAPTIVE_CORE_CFG}
fi

cat << EOF >> etc/horizon.env
export ENABLE_CAPTIVE_CORE_INGESTION=true
export STELLAR_CORE_BINARY_PATH=/usr/bin/stellar-core
Expand Down Expand Up @@ -433,7 +453,12 @@ function init_soroban_rpc() {
run_silent "finalize-soroban-rpc-captivecore-db" perl -pi -e "s*__DATABASE__*sqlite3://$SOROBAN_RPC_HOME/captive-core/stellar-rpc.db*g" $SOROBAN_RPC_CAPTIVE_CORE_CFG
perl -pi -e "s/__NETWORK__/$NETWORK_PASSPHRASE/g" $SOROBAN_RPC_CAPTIVE_CORE_CFG
run_silent "finalize-core-config-enable-soroban-diagnostic-events" perl -pi -e "s/__ENABLE_SOROBAN_DIAGNOSTIC_EVENTS__/$ENABLE_SOROBAN_DIAGNOSTIC_EVENTS/g" $SOROBAN_RPC_CAPTIVE_CORE_CFG


if [ "$NETWORK" = "standalone" ] && [ "${CORE_PROTOCOL_VERSION}" = "20" ]; then
echo "\n" >> ${HORIZON_CAPTIVE_CORE_CFG}
echo "TESTING_SOROBAN_HIGH_LIMIT_OVERRIDE=true\n" >> ${HORIZON_CAPTIVE_CORE_CFG}
fi

local ADMIN_ENDPOINT=0.0.0.0:6061
if [ "$ENABLE_SOROBAN_RPC_ADMIN_ENDPOINT" != "true" ]; then
ADMIN_ENDPOINT=
Expand Down

0 comments on commit 92dfb1e

Please sign in to comment.