Skip to content

Commit

Permalink
fix: ci error
Browse files Browse the repository at this point in the history
  • Loading branch information
zemyblue committed Oct 6, 2023
1 parent 75e6d80 commit fc1e364
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions ci_test/queue_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
FROM_ACCOUNT='alice'
TOKEN_NAME='ST1'

FNSAD=${FNSAD:-fnsad-proxy}

# This is a function that checks if executeMsg/quertMsg is successful.
check_run_info() {
local result="$1"
Expand All @@ -28,25 +30,25 @@ check_result() {
execute_and_check_query_msg() {
local query_msg="$1"
local expected_result="$2"
query_result=$(fnsad query wasm contract-state smart "$CONTRACT_ADDRESS" "$query_msg")
query_result=$(${FNSAD} query wasm contract-state smart "$CONTRACT_ADDRESS" "$query_msg")
check_run_info "$query_result" "$query_msg"
check_result "$query_result" "$expected_result"
}

# store `queue.wasm`
STORE_RES=$(fnsad tx wasm store contracts/queue.wasm --from $FROM_ACCOUNT --keyring-backend test --chain-id finschia --gas 1500000 -b block -o json -y)
STORE_RES=$(${FNSAD} tx wasm store contracts/queue.wasm --from $FROM_ACCOUNT --keyring-backend test --chain-id finschia --gas 1500000 -b block -o json -y)
CODE_ID=$(echo "$STORE_RES" | jq '.logs[] | select(.msg_index == 0) | .events[] | select(.type == "store_code") | .attributes[] | select(.key == "code_id") | .value | tonumber')

# instantiate `queue.wasm`
INIT_MSG=$(jq -nc '{}')
INSTANTIATE_RES=$(fnsad tx wasm instantiate "$CODE_ID" "$INIT_MSG" --label $TOKEN_NAME --admin "$(fnsad keys show $FROM_ACCOUNT -a --keyring-backend test)" --from $FROM_ACCOUNT --keyring-backend test --chain-id finschia -b block -o json -y)
INSTANTIATE_RES=$(${FNSAD} tx wasm instantiate "$CODE_ID" "$INIT_MSG" --label $TOKEN_NAME --admin "$(${FNSAD} keys show $FROM_ACCOUNT -a --keyring-backend test)" --from $FROM_ACCOUNT --keyring-backend test --chain-id finschia -b block -o json -y)
CONTRACT_ADDRESS=$(echo "$INSTANTIATE_RES" | jq '.logs[] | select(.msg_index == 0) | .events[] | select(.type == "instantiate") | .attributes[] | select(.key == "_contract_address") | .value' | sed 's/"//g')

# check enqueue
# now: {100, 200, 300}
for value in 100 200 300; do
ENQUEUE_MSG=$(jq -nc --arg value $value '{enqueue:{value:($value | tonumber)}}')
RUN_INFO=$(fnsad tx wasm execute "$CONTRACT_ADDRESS" "$ENQUEUE_MSG" --from $FROM_ACCOUNT --keyring-backend test --chain-id finschia -b block -y)
RUN_INFO=$(${FNSAD} tx wasm execute "$CONTRACT_ADDRESS" "$ENQUEUE_MSG" --from $FROM_ACCOUNT --keyring-backend test --chain-id finschia -b block -y)
check_run_info "$RUN_INFO" "$ENQUEUE_MSG"
done

Expand All @@ -59,7 +61,7 @@ execute_and_check_query_msg "$COUNT_MSG" "$EXPECTED_RESULT"
# check dequeue
# now: {200, 300}
DEQUEUE_MSG=$(jq -nc '{dequeue:{}}')
RUN_INFO=$(fnsad tx wasm execute "$CONTRACT_ADDRESS" "$DEQUEUE_MSG" --from $FROM_ACCOUNT --keyring-backend test --chain-id finschia -b block -y)
RUN_INFO=$(${FNSAD} tx wasm execute "$CONTRACT_ADDRESS" "$DEQUEUE_MSG" --from $FROM_ACCOUNT --keyring-backend test --chain-id finschia -b block -y)
check_run_info "$RUN_INFO" "$ENQUEUE_MSG"

# check sum
Expand Down
2 changes: 1 addition & 1 deletion contrib/check-upgrade-name.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

# get module version from go.mod
module_version=$(grep -E '^module github\.com/Finschia/finschia/v.*$' go.mod | cut -d / -f 4)
module_version=$(grep -E '^module github\.com/Finschia/finschia-proxy/v.*$' go.mod | cut -d / -f 4)
if [ -z "$module_version" ]
then
echo module version not found: you must update the script >&2
Expand Down

0 comments on commit fc1e364

Please sign in to comment.