diff --git a/tests/e2e-complex/upgrade/common.sh b/tests/e2e-complex/upgrade/common.sh index d746487b9..b94c1d557 100644 --- a/tests/e2e-complex/upgrade/common.sh +++ b/tests/e2e-complex/upgrade/common.sh @@ -8,7 +8,7 @@ CHEQD_IMAGE_TO="cheqd-cli" # shellcheck disable=SC2034 CHEQD_VERSION_TO=$(git describe --always --tag --match "v*" | sed 's/^v//') # shellcheck disable=SC2034 -UPGRADE_NAME="v0.4" +UPGRADE_NAME="v0.5" VOTING_PERIOD=30 EXPECTED_BLOCK_SECOND=5 EXTRA_BLOCKS=5 @@ -23,20 +23,19 @@ AMOUNT_BEFORE="19000000000000000" CHEQ_AMOUNT="1ncheq" CHEQ_AMOUNT_NUMBER="1" # shellcheck disable=SC2034 -DID_1="did:cheqd:testnet:abcdef" +DID_1="did:cheqd:testnet:1111111111111111" # shellcheck disable=SC2034 -DID_2="did:cheqd:testnet:higklm" +DID_2="did:cheqd:testnet:2222222222222222" # cheqd_noded docker wrapper - cheqd_noded_docker() { - docker run --rm \ - -v "$(pwd):/cheqd" \ - --network host \ - -u root \ - -e HOME=/cheqd \ - --entrypoint "cheqd-noded" \ - ${CHEQD_IMAGE_FROM} "$@" + docker run --rm \ + -v "$(pwd):/cheqd" \ + --network host \ + -u root \ + -e HOME=/cheqd \ + --entrypoint "cheqd-noded" \ + ${CHEQD_IMAGE_FROM} "$@" } # Parameters @@ -54,18 +53,18 @@ function docker_exec () { function docker_compose_up () { pushd "node_configs/node0" NODE_0_ID=$(cheqd_noded_docker tendermint show-node-id | sed 's/\r//g') - export NODE_0_ID + export NODE_0_ID="$NODE_0_ID" popd export CHEQD_IMAGE_NAME="$1" export MOUNT_POINT="$2" - docker-compose --env-file .env up -d + docker compose --env-file .env up -d } # Stop docker-compose function docker_compose_down () { - docker-compose --env-file .env down + docker compose --env-file .env down } # Clean environment @@ -84,7 +83,6 @@ function make_777 () { } - # Transaction related funcs function random_string() { @@ -94,7 +92,8 @@ function random_string() { function get_addresses () { all_keys=$(local_client_tx keys list) - mapfile -t addresses < <(echo "$all_keys" | grep -o 'cheqd1.*') +# mapfile -t addresses < <(echo "$all_keys" | grep -o 'cheqd1.*') + addresses=( $(echo "$all_keys" | grep -o 'cheqd1.*') ) echo "${addresses[@]}" } @@ -120,7 +119,7 @@ function send_tokens() { # Send DID # input: DID to write -function send_did_old() { +function send_did_new () { did_to_write=$1 # Generate Alice identity key @@ -136,7 +135,7 @@ function send_did_old() { MSG_CREATE_DID='{"id":"'${did_to_write}'","verification_method":[{"id":"'"${KEY_ID}"'","type":"Ed25519VerificationKey2020","controller":"'${did_to_write}'","public_key_multibase":"'${ALICE_VER_PUB_MULTIBASE_58}'"}],"authentication":["'${KEY_ID}'"]}' # Post the message - did=$(local_client_tx tx cheqd create-did "${MSG_CREATE_DID}" "${KEY_ID}" --ver-key "${ALICE_VER_PRIV_BASE_64}" \ + did=$(local_client_tx tx cheqd create-did "${MSG_CREATE_DID}" "${KEY_ID}" "${ALICE_VER_PRIV_BASE_64}" \ --from operator0 \ --gas-prices "25ncheq" \ --chain-id $CHAIN_ID \ @@ -150,7 +149,7 @@ function send_did_old() { # Send DID # input: DID to write -function send_did() { +function send_did () { did_to_write=$1 # Generate Alice identity key @@ -166,7 +165,8 @@ function send_did() { MSG_CREATE_DID='{"id":"'${did_to_write}'","verification_method":[{"id":"'"${KEY_ID}"'","type":"Ed25519VerificationKey2020","controller":"'${did_to_write}'","public_key_multibase":"'${ALICE_VER_PUB_MULTIBASE_58}'"}],"authentication":["'${KEY_ID}'"]}' # Post the message - did=$(local_client_tx tx cheqd create-did "${MSG_CREATE_DID}" "${KEY_ID}" "${ALICE_VER_PRIV_BASE_64}" \ + did=$(local_client_tx tx cheqd create-did "${MSG_CREATE_DID}" "${KEY_ID}" \ + --ver-key "${ALICE_VER_PRIV_BASE_64}" \ --from operator0 \ --gas-prices "25ncheq" \ --chain-id $CHAIN_ID \ diff --git a/tests/e2e-complex/upgrade/prepare.sh b/tests/e2e-complex/upgrade/prepare.sh index f3f5f14f2..dae6f82af 100755 --- a/tests/e2e-complex/upgrade/prepare.sh +++ b/tests/e2e-complex/upgrade/prepare.sh @@ -29,7 +29,7 @@ OP2_ADDRESS=${addresses[2]} send_tokens "$OP2_ADDRESS" # Send DID transaction -send_did_old "$DID_1" +send_did "$DID_1" # Check that token transaction exists check_tx_hashes diff --git a/tests/e2e-complex/upgrade/upgrade_and_check.sh b/tests/e2e-complex/upgrade/upgrade_and_check.sh index bd543978e..40dd93af9 100755 --- a/tests/e2e-complex/upgrade/upgrade_and_check.sh +++ b/tests/e2e-complex/upgrade/upgrade_and_check.sh @@ -5,6 +5,16 @@ set -euox pipefail # shellcheck disable=SC1091 . common.sh +cheqd_noded_docker() { + docker run --rm \ + -v "$(pwd):/home/cheqd" \ + --network host \ + -u root \ + -e HOME=/home/cheqd \ + --entrypoint "cheqd-noded" \ + ${CHEQD_IMAGE_TO} "$@" +} + # Wait for upgrade height bash ../../tools/wait-for-chain.sh "$UPGRADE_HEIGHT" $((2 * VOTING_PERIOD)) @@ -46,7 +56,7 @@ check_did "$DID_1" send_tokens "$OP_ADDRESS_AFTER" # Send DID after upgrade -send_did "$DID_2" +send_did_new "$DID_2" # Check balance after token sending check_balance "$OP_ADDRESS_AFTER"