diff --git a/integration-tests/Makefile b/integration-tests/Makefile index e7b105cfc..dbd5b93f0 100644 --- a/integration-tests/Makefile +++ b/integration-tests/Makefile @@ -10,7 +10,10 @@ PYTHON := $(VENV_BIN)/python HELM_CHART=network PLATFORM=linux/amd64 -GCR_REPO = gcr.io/stride-nodes/integration-tests +GCR_REPO=gcr.io/stride-nodes/integration-tests + +ADMINS_FILE=../utils/admins.go +KEYS_FILE=network/configs/keys.json # Builds and pushes a docker image # args: [image-file-suffix] [context] [image-name] @@ -56,8 +59,7 @@ build-api: $(call build_and_push_docker,api,api,api:latest) build-stride: - @$(DOCKER) buildx build --platform linux/amd64 --tag core:stride .. - $(call build_and_push_docker,stride,.,chains/stride:latest) + @bash network/scripts/build.sh stride build-cosmos: $(call build_and_push_docker,cosmos,.,chains/cosmoshub:v18.1.0) diff --git a/integration-tests/network/configs/keys.json b/integration-tests/network/configs/keys.json index 31c0ace23..44cfdb8df 100644 --- a/integration-tests/network/configs/keys.json +++ b/integration-tests/network/configs/keys.json @@ -2,6 +2,7 @@ "admin": { "name": "admin", + "address": "stride1u20df3trc2c2zdhm8qvh2hdjx9ewh00sv6eyy8", "mnemonic": "tone cause tribe this switch near host damage idle fragile antique tail soda alien depth write wool they rapid unfold body scan pledge soft" }, "faucet": { diff --git a/integration-tests/network/scripts/build.sh b/integration-tests/network/scripts/build.sh new file mode 100644 index 000000000..b4bd76d20 --- /dev/null +++ b/integration-tests/network/scripts/build.sh @@ -0,0 +1,54 @@ +#!/bin/bash +set -eu + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +STRIDE_HOME=$SCRIPT_DIR/../../.. + +CHAIN=$1 + +PLATFORM=linux/amd64 +GCR_REPO=gcr.io/stride-nodes/integration-tests +ADMINS_FILE=${STRIDE_HOME}/utils/admins.go +KEYS_FILE=${STRIDE_HOME}/integration-tests/network/configs/keys.json +DOCKERFILES=${STRIDE_HOME}/integration-tests/dockerfiles + +# Builds and pushes a docker image to GCR +build_and_push_docker() { + dockerfile_suffix=$1 + context=$2 + image_name=$3 + + local_tag=stride-tests:$dockerfile_suffix + global_tag=$GCR_REPO/${image_name} + + echo "Building docker image: $dockerfile_suffix" + docker buildx build --platform $PLATFORM --tag $local_tag -f ${DOCKERFILES}/Dockerfile.$dockerfile_suffix $context + docker tag $local_tag $global_tag + + echo "Pushing image to GCR: $global_tag" + docker push $global_tag +} + +main() { + # For stride, we have to update the admin address + if [[ "$CHAIN" == "stride" ]]; then + # Trap SIGINT (Control + C) to cleanup admins file + trap 'echo "Interrupt received, cleaning up..."; git checkout -- $ADMINS_FILE && rm -f ${ADMINS_FILE}-E; exit' INT + + # Update the admin address + admin_address=$(jq -r '.admin.address' $KEYS_FILE) + sed -i -E "s|stride1k8c2m5cn322akk5wy8lpt87dd2f4yh9azg7jlh|$admin_address|g" $ADMINS_FILE + + # First build the main dockerfile in the repo root, then build the integration test specific file + docker buildx build --platform linux/amd64 --tag core:stride .. + build_and_push_docker stride . chains/stride:latest + + # Cleanup the admins file + git checkout -- $ADMINS_FILE && rm -f ${ADMINS_FILE}-E + else + echo "ERROR: Chain not supported" + exit 1 + fi +} + +main diff --git a/integration-tests/network/scripts/config.sh b/integration-tests/network/scripts/config.sh index ff9662652..5c54723e4 100644 --- a/integration-tests/network/scripts/config.sh +++ b/integration-tests/network/scripts/config.sh @@ -27,6 +27,7 @@ DEPOSIT_PERIOD="30s" VOTING_PERIOD="30s" EXPEDITED_VOTING_PERIOD="29s" UNBONDING_TIME="240s" +AIRDROP_PERIOD_SECONDS=86400 STRIDE_DAY_EPOCH_DURATION="140s" STRIDE_EPOCH_EPOCH_DURATION="35s" \ No newline at end of file diff --git a/integration-tests/network/scripts/init-chain.sh b/integration-tests/network/scripts/init-chain.sh index 3169c0421..f23a7ad9d 100644 --- a/integration-tests/network/scripts/init-chain.sh +++ b/integration-tests/network/scripts/init-chain.sh @@ -139,6 +139,8 @@ update_stride_genesis() { $BINARY add-consumer-section --validator-public-keys $validator_public_keys jq_inplace '.app_state.ccvconsumer.params.unbonding_period |= "'$UNBONDING_TIME'"' $genesis_json + + jq_inplace '.app_state.airdrop.params.period_length_seconds |= "'${AIRDROP_PERIOD_LENGTH}'"' $genesis_json } # Genesis updates specific to non-stride chains