Skip to content

Commit f672d50

Browse files
committed
#303 Upgrade Cosmos-SDK to v0.47.3
- Add extra line into shell tests to get `txn` status Signed-off-by: Abdulbois <abdulbois.tursunov@dsr-corporation.com> Signed-off-by: Abdulbois <abdulbois123@gmail.com>
1 parent bd62778 commit f672d50

31 files changed

+403
-43
lines changed

genlocalnetconfig.sh

+1
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ if [[ -n "$DCL_LIGHT_CLIENT_PROXY" ]]; then
215215
init_light_client_proxy lightclient0
216216
fi
217217

218+
chmod 777 -R $DCL_DIR
218219
#if [ -n "$MAINNET_STABLE_VERSION" ]; then
219220
# rm dcld
220221
#fi

integration_tests/cli/auth-demo-hex.sh

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ pid=2577
4444

4545
echo "Jack proposes account for $user"
4646
result=$(echo $passphrase | dcld tx auth propose-add-account --info="Jack is proposing this account" --address="$user_address" --pubkey="$user_pubkey" --roles="Vendor" --vid="$vid_in_hex_format" --from jack --yes)
47+
result=$(get_txn_result "$result")
4748
check_response "$result" "\"code\": 0"
4849

4950
test_divider
@@ -77,6 +78,7 @@ test_divider
7778
productName="Device #1"
7879
echo "$user adds Model with VID: $vid_in_hex_format PID: $pid"
7980
result=$(echo "test1234" | dcld tx model add-model --vid=$vid_in_hex_format --pid=$pid_in_hex_format --productName="$productName" --productLabel="Device Description" --commissioningCustomFlow=0 --deviceTypeID=12 --partNumber=12 --from=$user_address --yes)
81+
result=$(get_txn_result "$result")
8082
check_response_and_report "$result" "\"code\": 0"
8183

8284
test_divider
@@ -85,12 +87,14 @@ vid_plus_one_in_hex_format=0xA14
8587
vidPlusOne=$((vid_in_hex_format+1))
8688
echo "$user adds Model with a VID: $vid_plus_one_in_hex_format PID: $pid_in_hex_format, This fails with Permission denied as the VID is not associated with this vendor account."
8789
result=$(echo "test1234" | dcld tx model add-model --vid=$vid_plus_one_in_hex_format --pid=$pid_in_hex_format --productName="$productName" --productLabel="Device Description" --commissioningCustomFlow=0 --deviceTypeID=12 --partNumber=12 --from=$user_address --yes 2>&1) || true
90+
result=$(get_txn_result "$result")
8891
check_response_and_report "$result" "transaction should be signed by a vendor account containing the vendorID $vidPlusOne"
8992

9093
test_divider
9194

9295
echo "$user updates Model with VID: $vid_in_hex_format PID: $pid_in_hex_format"
9396
result=$(echo "test1234" | dcld tx model update-model --vid=$vid_in_hex_format --pid=$pid_in_hex_format --productName="$productName" --productLabel="Device Description" --partNumber=12 --from=$user_address --yes)
97+
result=$(get_txn_result "$result")
9498
check_response_and_report "$result" "\"code\": 0"
9599

96100
test_divider

integration_tests/cli/auth-demo.sh

+53
Large diffs are not rendered by default.

integration_tests/cli/common.sh

+24
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,13 @@ create_new_account(){
122122

123123
echo "Jack proposes account for \"$name\" with roles: \"$roles\""
124124
result=$(echo $passphrase | dcld tx auth propose-add-account --address="$address" --pubkey="$pubkey" --roles=$roles --from jack --yes)
125+
result=$(get_txn_result "$result")
125126
check_response "$result" "\"code\": 0"
126127
echo "$result"
127128

128129
echo "Alice approves account for \"$name\" with roles: \"$roles\""
129130
result=$(echo $passphrase | dcld tx auth approve-add-account --address="$address" --from alice --yes)
131+
result=$(get_txn_result "$result")
130132
check_response "$result" "\"code\": 0"
131133
echo "$result"
132134
}
@@ -149,6 +151,7 @@ create_new_vendor_account(){
149151
echo "Jack proposes account for \"$_name\" with Vendor role"
150152
_result=$(echo $passphrase | dcld tx auth propose-add-account --address="$_address" --pubkey="$_pubkey" --roles=Vendor --vid=$_vid --from jack --yes)
151153
fi
154+
_result=$(get_txn_result "$_result")
152155
check_response "$_result" "\"code\": 0"
153156

154157
}
@@ -160,8 +163,10 @@ create_model_and_version() {
160163
local _softwareVersionString="$4"
161164
local _user_address="$5"
162165
result=$(echo "$passphrase" | dcld tx model add-model --vid=$_vid --pid=$_pid --deviceTypeID=1 --productName=TestProduct --productLabel=TestingProductLabel --partNumber=1 --commissioningCustomFlow=0 --from=$_user_address --yes)
166+
result=$(get_txn_result "$result")
163167
check_response "$result" "\"code\": 0"
164168
result=$(echo "$passphrase" | dcld tx model add-model-version --cdVersionNumber=1 --maxApplicableSoftwareVersion=10 --minApplicableSoftwareVersion=1 --vid=$_vid --pid=$_pid --softwareVersion=$_softwareVersion --softwareVersionString=$_softwareVersionString --from=$_user_address --yes)
169+
result=$(get_txn_result "$result")
165170
check_response "$result" "\"code\": 0"
166171
}
167172

@@ -238,3 +243,22 @@ execute_with_retry() {
238243

239244
echo "$_result"
240245
}
246+
247+
248+
get_txn_result() {
249+
local _broadcast_result=${1}
250+
local _txHash=$(echo "$_broadcast_result" | jq -r '.txhash')
251+
local _command="dcld query tx $_txHash"
252+
local _result=$($_command 2>&1)
253+
254+
for i in {1..10}; do
255+
if [[ "$(_check_response "$_result" "not found" "raw")" == true ]]; then
256+
sleep 2
257+
_result=$($_command 2>&1)
258+
else
259+
break
260+
fi
261+
done
262+
263+
echo "$_result"
264+
}

integration_tests/cli/compliance-demo-hex.sh

+11
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,15 @@ cd_certificate_id="some ID"
4848

4949
echo "Add Model with VID: $vid_in_hex_format PID: $pid_in_hex_format"
5050
result=$(echo "$passphrase" | dcld tx model add-model --vid=$vid_in_hex_format --pid=$pid_in_hex_format --deviceTypeID=1 --productName=TestProduct --productLabel=TestingProductLabel --partNumber=1 --commissioningCustomFlow=0 --from $vendor_account --yes)
51+
result=$(get_txn_result "$result")
5152
echo $result
5253
check_response "$result" "\"code\": 0"
5354

5455
test_divider
5556

5657
echo "Certify unknown Model Version with VID: $vid_in_hex_format PID: $pid_in_hex_format SV: ${sv} with zigbee certification"
5758
result=$(echo "$passphrase" | dcld tx compliance certify-model --vid=$vid_in_hex_format --pid=$pid_in_hex_format --softwareVersion=$sv --softwareVersionString=$svs --certificationType="$zigbee_certification_type" --certificationDate="$certification_date" --cdCertificateId="$cd_certificate_id" --from $zb_account --yes)
59+
result=$(get_txn_result "$result")
5860
echo "$result"
5961
check_response "$result" "\"code\": 517"
6062
check_response "$result" "No model version"
@@ -63,6 +65,7 @@ test_divider
6365

6466
echo "Add Model Version with VID: $vid_in_hex_format PID: $pid_in_hex_format SV: $sv SoftwareVersionString:$svs"
6567
result=$(echo '$passphrase' | dcld tx model add-model-version --cdVersionNumber=1 --maxApplicableSoftwareVersion=10 --minApplicableSoftwareVersion=1 --vid=$vid_in_hex_format --pid=$pid_in_hex_format --softwareVersion=$sv --softwareVersionString=$svs --from=$vendor_account --yes)
68+
result=$(get_txn_result "$result")
6669
echo $result
6770
check_response "$result" "\"code\": 0"
6871

@@ -116,13 +119,15 @@ test_divider
116119
invalid_svs=$RANDOM
117120
echo "Certify Model with VID: $vid_in_hex_format PID: $pid_in_hex_format SV: ${sv} with zigbee certification and invalid SoftwareVersionString: $invalid_svs"
118121
result=$(echo "$passphrase" | dcld tx compliance certify-model --vid=$vid_in_hex_format --pid=$pid_in_hex_format --softwareVersion=$sv --softwareVersionString=$invalid_svs --certificationType="$zigbee_certification_type" --certificationDate="$certification_date" --cdCertificateId="$cd_certificate_id" --from $zb_account --yes)
122+
result=$(get_txn_result "$result")
119123
check_response "$result" "\"code\": 306"
120124
# check_response "$result" "failed to execute message; message index: 0: Model with vid=$vid, pid=$pid, softwareVersion=$sv present on the ledger does not have matching softwareVersionString=$invalid_svs: model version does not match"
121125

122126
test_divider
123127

124128
echo "Certify Model with VID: $vid_in_hex_format PID: $pid_in_hex_format SV: ${sv} with zigbee certification"
125129
result=$(echo "$passphrase" | dcld tx compliance certify-model --vid=$vid_in_hex_format --pid=$pid_in_hex_format --softwareVersion=$sv --softwareVersionString=$svs --certificationType="$zigbee_certification_type" --certificationDate="$certification_date" --cdCertificateId="$cd_certificate_id" --cdVersionNumber=1 --from $zb_account --yes)
130+
result=$(get_txn_result "$result")
126131
echo "$result"
127132
check_response "$result" "\"code\": 0"
128133

@@ -131,6 +136,7 @@ test_divider
131136
echo "Certify Model with VID: $vid_in_hex_format PID: $pid_in_hex_format SV: ${sv} with matter certification"
132137
echo "dcld tx compliance certify-model --vid=$vid_in_hex_format --pid=$pid_in_hex_format --softwareVersion=$sv --softwareVersionString=$svs --certificationType="$matter_certification_type" --certificationDate="$certification_date" --from $zb_account --yes"
133138
result=$(echo "$passphrase" | dcld tx compliance certify-model --vid=$vid_in_hex_format --pid=$pid_in_hex_format --softwareVersion=$sv --softwareVersionString=$svs --certificationType="$matter_certification_type" --certificationDate="$certification_date" --cdCertificateId="$cd_certificate_id" --cdVersionNumber=1 --from $zb_account --yes)
139+
result=$(get_txn_result "$result")
134140
echo "$result"
135141
check_response "$result" "\"code\": 0"
136142

@@ -139,6 +145,7 @@ test_divider
139145
echo "ReCertify Model with VID: $vid_in_hex_format PID: $pid_in_hex_format SV: ${sv} by different account"
140146
zigbee_certification_type="zigbee"
141147
result=$(echo "$passphrase" | dcld tx compliance certify-model --vid=$vid_in_hex_format --pid=$pid_in_hex_format --softwareVersion=$sv --softwareVersionString=$svs --certificationType="$zigbee_certification_type" --certificationDate="$certification_date" --cdCertificateId="$cd_certificate_id" --cdVersionNumber=1 --from $second_zb_account --yes)
148+
result=$(get_txn_result "$result")
142149
check_response "$result" "\"code\": 303"
143150
check_response "$result" "already certified on the ledger"
144151
echo "$result"
@@ -148,6 +155,7 @@ test_divider
148155
echo "ReCertify Model with VID: $vid_in_hex_format PID: $pid_in_hex_format SV: ${sv} by same account"
149156
zigbee_certification_type="zigbee"
150157
result=$(echo "$passphrase" | dcld tx compliance certify-model --vid=$vid_in_hex_format --pid=$pid_in_hex_format --softwareVersion=$sv --softwareVersionString=$svs --certificationType="$zigbee_certification_type" --certificationDate="$certification_date" --cdCertificateId="$cd_certificate_id" --cdVersionNumber=1 --from $zb_account --yes)
158+
result=$(get_txn_result "$result")
151159
check_response "$result" "\"code\": 303"
152160
check_response "$result" "already certified on the ledger"
153161
echo "$result"
@@ -249,6 +257,7 @@ revocation_reason="some reason"
249257
echo "Revoke Certification for Model with VID: $vid_in_hex_format PID: $pid_in_hex_format SV: ${sv} from the past"
250258
revocation_date_past="2020-01-01T00:00:00Z"
251259
result=$(echo "$passphrase" | dcld tx compliance revoke-model --vid=$vid_in_hex_format --pid=$pid_in_hex_format --softwareVersion=$sv --softwareVersionString=$svs --certificationType="$zigbee_certification_type" --revocationDate="$revocation_date_past" --reason "$revocation_reason" --cdVersionNumber=1 --from $zb_account --yes)
260+
result=$(get_txn_result "$result")
252261
check_response "$result" "\"code\": 302"
253262
check_response "$result" "must be after"
254263
echo "$result"
@@ -259,6 +268,7 @@ test_divider
259268
echo "Revoke Certification for Model with VID: $vid_in_hex_format PID: $pid_in_hex_format SV: ${sv} "
260269
revocation_date="2020-02-02T02:20:20Z"
261270
result=$(echo "$passphrase" | dcld tx compliance revoke-model --vid=$vid_in_hex_format --pid=$pid_in_hex_format --softwareVersion=$sv --softwareVersionString=$svs --certificationType="$zigbee_certification_type" --revocationDate="$revocation_date" --reason "$revocation_reason" --cdVersionNumber=1 --from $zb_account --yes)
271+
result=$(get_txn_result "$result")
262272
check_response "$result" "\"code\": 0"
263273
echo "$result"
264274

@@ -314,6 +324,7 @@ test_divider
314324
echo "Again Certify Model with VID: $vid_in_hex_format PID: $pid_in_hex_format SV: ${sv}"
315325
certification_date="2020-03-03T00:00:00Z"
316326
result=$(echo "$passphrase" | dcld tx compliance certify-model --vid=$vid_in_hex_format --pid=$pid_in_hex_format --softwareVersion=$sv --softwareVersionString=$svs --certificationType="$zigbee_certification_type" --certificationDate="$certification_date" --cdCertificateId="$cd_certificate_id" --cdVersionNumber=1 --from $zb_account --yes)
327+
result=$(get_txn_result "$result")
317328
check_response "$result" "\"code\": 0"
318329
echo "$result"
319330

0 commit comments

Comments
 (0)