diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml index 22bdee847..185df740a 100644 --- a/.github/workflows/node-ci.yml +++ b/.github/workflows/node-ci.yml @@ -333,7 +333,7 @@ jobs: - name: Run test net container run: | - docker run -d --rm -p "26657:26657" cheqd-testnet + docker run -d --rm -p "26657:26657" -p "1317:1317" cheqd-testnet bash tests/networks/wait_for_chain.sh - name: Set up and run tests diff --git a/docker/single_image_testnet/gen_node_configs.sh b/docker/single_image_testnet/gen_node_configs.sh index 978a072b9..119118607 100755 --- a/docker/single_image_testnet/gen_node_configs.sh +++ b/docker/single_image_testnet/gen_node_configs.sh @@ -27,6 +27,10 @@ echo "##### [Node 0] Set fee" sed -i $sed_extension 's/minimum-gas-prices = ""/minimum-gas-prices = "25ncheq"/g' "$HOME/.cheqdnode/config/app.toml" +echo "##### [Node 0] Switch on REST API" + +sed -i $sed_extension 's/enable = false/enable = true/g' "$HOME/.cheqdnode/config/app.toml" + echo "##### [Node 0] Adjust consensus timeouts" sed -i $sed_extension 's/timeout_propose = "3s"/timeout_propose = "500ms"/g' "$HOME/.cheqdnode/config/config.toml" diff --git a/scripts/protocgen.sh b/scripts/protocgen.sh index cadf77b2f..2e0420791 100644 --- a/scripts/protocgen.sh +++ b/scripts/protocgen.sh @@ -28,7 +28,7 @@ Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types:. \ -I "proto" \ -I "$cosmos_sdk_dir/third_party/proto" \ -I "$cosmos_sdk_dir/proto" \ - --grpc-gateway_out=logtostderr=true:. \ + --grpc-gateway_out=logtostderr=true,allow_colon_final_segments=true:. \ $(find "${dir}" -maxdepth 1 -name '*.proto') done diff --git a/tests/cli/tests/query_did_2.sh b/tests/cli/tests/query_did_2.sh new file mode 100644 index 000000000..6f69e6f6c --- /dev/null +++ b/tests/cli/tests/query_did_2.sh @@ -0,0 +1,73 @@ +#!/bin/bash + +# set -euox pipefail + +# sed in macos requires extra argument + +sed_extension='' +if [[ "$OSTYPE" == "linux-gnu"* ]]; then + sed_extension='' +elif [[ "$OSTYPE" == "darwin"* ]]; then + sed_extension='.orig' +fi + +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +source "$SCRIPT_DIR/common.sh" + + +# Creating DID +ALICE_VER_KEY="$(cheqd-noded debug ed25519 random)" +ALICE_VER_PUB_BASE_64=$(echo "${ALICE_VER_KEY}" | jq -r ".pub_key_base_64") +ALICE_VER_PRIV_BASE_64=$(echo "${ALICE_VER_KEY}" | jq -r ".priv_key_base_64") +ALICE_VER_PUB_MULTIBASE_58=$(cheqd-noded debug encoding base64-multibase58 "${ALICE_VER_PUB_BASE_64}") + +DID="did:cheqd:testnet:$(random_string)" +KEY_ID="${DID}#key1" + +MSG_CREATE_DID='{ + "id": "'${DID}'", + "verification_method": [{ + "id": "'${KEY_ID}'", + "type": "Ed25519VerificationKey2020", + "controller": "'${DID}'", + "public_key_multibase": "'${ALICE_VER_PUB_MULTIBASE_58}'" + }], + "authentication": [ + "'${KEY_ID}'" + ] +}'; + +RESULT=$(cheqd-noded tx cheqd create-did "${MSG_CREATE_DID}" "${KEY_ID}" --ver-key "${ALICE_VER_PRIV_BASE_64}" \ + --from "${BASE_ACCOUNT_1}" ${TX_PARAMS}) + +assert_tx_successful "$RESULT" + + +# Query DID +RESULT=$(curl http://localhost:1317/cheqd/cheqdnode/cheqd/did/"${DID}") + +EXPECTED='{ + "context":[], + "id":"'${DID}'", + "controller":[], + "verification_method":[ + { + "id":"'${KEY_ID}'", + "type":"Ed25519VerificationKey2020", + "controller":"'${DID}'", + "public_key_jwk":[], + "public_key_multibase":"'${ALICE_VER_PUB_MULTIBASE_58}'" + } + ], + "authentication":[ + "'${KEY_ID}'" + ], + "assertion_method":[], + "capability_invocation":[], + "capability_delegation":[], + "key_agreement":[], + "service":[], + "also_known_as":[] +}' + +assert_json_eq "${EXPECTED}" "$(echo "$RESULT" | jq -r ".did")" diff --git a/tests/networks/local_node/gen_node_config.sh b/tests/networks/local_node/gen_node_config.sh index e98be0ed0..1d3a3fd20 100755 --- a/tests/networks/local_node/gen_node_config.sh +++ b/tests/networks/local_node/gen_node_config.sh @@ -24,6 +24,16 @@ sed -i $sed_extension 's/minimum-gas-prices = ""/minimum-gas-prices = "25ncheq"/ cheqd-noded keys add "node_operator" --keyring-backend "test" cheqd-noded add-genesis-account "node_operator" 20000000000000000ncheq --keyring-backend "test" +echo "##### [Node 0] Switch on REST API" + +sed -i $sed_extension 's/enable = false/enable = true/g' "$HOME/.cheqdnode/config/app.toml" + +echo "##### [Node 0] Adjust consensus timeouts" + +sed -i $sed_extension 's/timeout_propose = "3s"/timeout_propose = "500ms"/g' "$HOME/.cheqdnode/config/config.toml" +sed -i $sed_extension 's/timeout_prevote = "1s"/timeout_prevote = "500ms"/g' "$HOME/.cheqdnode/config/config.toml" +sed -i $sed_extension 's/timeout_precommit = "1s"/timeout_precommit = "500ms"/g' "$HOME/.cheqdnode/config/config.toml" +sed -i $sed_extension 's/timeout_commit = "5s"/timeout_commit = "500ms"/g' "$HOME/.cheqdnode/config/config.toml" echo "##### Adding test accounts to the genesis"