diff --git a/bouncer/shared/upgrade_network.ts b/bouncer/shared/upgrade_network.ts index c7d1ab67ca..9fa4b69c76 100755 --- a/bouncer/shared/upgrade_network.ts +++ b/bouncer/shared/upgrade_network.ts @@ -10,7 +10,6 @@ import { compileBinaries } from './utils/compile_binaries'; import { submitRuntimeUpgradeWithRestrictions } from './submit_runtime_upgrade'; import { execWithLog } from './utils/exec_with_log'; import { submitGovernanceExtrinsic } from './cf_governance'; -import { setupLpAccount } from './setup_lp_account'; async function readPackageTomlVersion(projectRoot: string): Promise { const data = await fs.readFile(path.join(projectRoot, '/state-chain/runtime/Cargo.toml'), 'utf8'); @@ -339,17 +338,23 @@ export async function upgradeNetworkPrebuilt( ); } - // Temp: until localnet/bouncer initialises to a version where the LP_API is funded already. - if (cleanOldVersion.startsWith('1.6')) { - console.log('Setting up LP account and adding liquidity for the LP-API.'); - // Liquidity is provided as part of the LP-API test setup. - await setupLpAccount('//LP_API'); - // Write LP_API key to keys/ so that the LP-API can use it - when upgrading the old version, which the upgrade-test is - // started from doesn't yet have this key. - await fs.writeFile( - `${localnetInitPath}/keys/LP_API`, - '8e1866e65039304e4142f09452a8305acd28d0ae0b833cd268b21a57d68782c1', - ); + // Temp: until localnet/bouncer initialises to a version where the deposit-monitor is started already. + if (cleanOldVersion.startsWith('1.7')) { + console.log('Starting up deposit-monitor.'); + + execWithLog(`${localnetInitPath}/scripts/start-broker-api.sh`, 'start-broker-api', { + DEPOSIT_MONITOR_CONTAINER: 'deposit-monitor', + DOCKER_COMPOSE_CMD: 'docker-compose', + additional_docker_compose_up_args: '--quiet-pull', + }); + + try { + const pid = execSync(`lsof -t -i:6060`); + console.log(`New deposit-monitor PID: ${pid.toString()}`); + } catch (e) { + console.error(`Error starting deposit-monitor: ${e}`); + throw e; + } } if (cleanOldVersion === nodeVersion) { diff --git a/localnet/common.sh b/localnet/common.sh index f385822a28..087447803f 100644 --- a/localnet/common.sh +++ b/localnet/common.sh @@ -4,7 +4,7 @@ export GENESIS_NODES=("bashful" "doc" "dopey") export REQUIRED_BINARIES="engine-runner chainflip-node chainflip-broker-api chainflip-lp-api" export INIT_CONTAINERS="eth-init solana-init" export CORE_CONTAINERS="bitcoin geth polkadot redis" -export CF_CONTAINERS="deposit-monitor" +export DEPOSIT_MONITOR_CONTAINER="deposit-monitor" export ARB_CONTAINERS="sequencer staker-unsafe poster" export SOLANA_BASE_PATH="/tmp/solana" export CHAINFLIP_BASE_PATH="/tmp/chainflip" @@ -173,26 +173,11 @@ build-localnet() { echo "🤑 Starting LP API ..." KEYS_DIR=$KEYS_DIR ./$LOCALNET_INIT_DIR/scripts/start-lp-api.sh $BINARY_ROOT_PATH - echo "🔬 Starting Deposit Monitor API ..." - # On some machines (e.g. MacOS), 172.17.0.1 is not accessible from inside the container, so we need to use host.docker.internal - if [[ $CI == true ]]; then - export CFDM_BROKER_API_URL='ws://172.17.0.1:10997' - else - export CFDM_BROKER_API_URL='ws://host.docker.internal:10997' - fi - $DOCKER_COMPOSE_CMD -f localnet/docker-compose.yml -p "chainflip-localnet" up $CF_CONTAINERS $additional_docker_compose_up_args -d >>$DEBUG_OUTPUT_DESTINATION 2>&1 - while true; do - echo "🩺 Checking deposit-monitor's health ..." - REPLY=$(check_endpoint_health 'http://localhost:6060/health') - starting=$(echo $REPLY | jq .starting) - all_healthy=$(echo $REPLY | jq .all_processors) - if test "$starting" == "false" && test "$all_healthy" == "true" ; then - echo "💚 deposit-monitor is running!" - break - fi - sleep 1 - done - + echo "🔬 Starting Deposit Monitor ..." + DOCKER_COMPOSE_CMD=$DOCKER_COMPOSE_CMD \ + DEPOSIT_MONITOR_CONTAINER=$DEPOSIT_MONITOR_CONTAINER \ + additional_docker_compose_up_args=$additional_docker_compose_up_args \ + ./$LOCALNET_INIT_DIR/scripts/start-deposit-monitor.sh if [[ $START_TRACKER == "y" ]]; then echo "👁 Starting Ingress-Egress-tracker ..." diff --git a/localnet/init/scripts/start-deposit-monitor.sh b/localnet/init/scripts/start-deposit-monitor.sh new file mode 100755 index 0000000000..0bdb023931 --- /dev/null +++ b/localnet/init/scripts/start-deposit-monitor.sh @@ -0,0 +1,23 @@ +#!/bin/bash +set -e + +source ./localnet/helper.sh + +# On some machines (e.g. MacOS), 172.17.0.1 is not accessible from inside the container, so we need to use host.docker.internal +if [[ $CI == true ]]; then + export CFDM_BROKER_API_URL='ws://172.17.0.1:10997' +else + export CFDM_BROKER_API_URL='ws://host.docker.internal:10997' +fi +$DOCKER_COMPOSE_CMD -f localnet/docker-compose.yml -p "chainflip-localnet" up $DEPOSIT_MONITOR_CONTAINER $additional_docker_compose_up_args -d >>$DEBUG_OUTPUT_DESTINATION 2>&1 +while true; do + echo "🩺 Checking deposit-monitor's health ..." + REPLY=$(check_endpoint_health 'http://localhost:6060/health') + starting=$(echo $REPLY | jq .starting) + all_healthy=$(echo $REPLY | jq .all_processors) + if test "$starting" == "false" && test "$all_healthy" == "true" ; then + echo "💚 deposit-monitor is running!" + break + fi + sleep 1 +done \ No newline at end of file