Skip to content

Commit 7b86d9f

Browse files
committed
Fix linter issues and integration tests
1 parent f05443e commit 7b86d9f

File tree

5 files changed

+22
-21
lines changed

5 files changed

+22
-21
lines changed

integration_tests/light_client_proxy/pki.sh

100644100755
+11-10
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,15 @@ dcld config node tcp://localhost:26657
131131
trustee_account="jack"
132132
second_trustee_account="alice"
133133

134-
echo "Create regular account"
135-
create_new_account user_account "CertificationCenter"
134+
vendor_account=vendor_account_$vid
135+
echo "Create Vendor account - $vendor_account"
136+
create_new_vendor_account $vendor_account $vid
136137

137138
test_divider
138139

139-
echo "$user_account (Not Trustee) propose Root certificate"
140+
echo "$vendor_account (Not Trustee) propose Root certificate"
140141
root_path="integration_tests/constants/root_cert"
141-
result=$(echo "$passphrase" | dcld tx pki propose-add-x509-root-cert --certificate="$root_path" --vid $vid --from $user_account --yes)
142+
result=$(echo "$passphrase" | dcld tx pki propose-add-x509-root-cert --certificate="$root_path" --vid $vid --from $vendor_account --yes)
142143
response_does_not_contain "$result" "\"code\": 0"
143144
echo "$result"
144145

@@ -159,24 +160,24 @@ echo "$result"
159160

160161
test_divider
161162

162-
echo "$user_account (Not Trustee) add Intermediate certificate"
163+
echo "$vendor_account (Vendor) add Intermediate certificate"
163164
intermediate_path="integration_tests/constants/intermediate_cert"
164-
result=$(echo "$passphrase" | dcld tx pki add-x509-cert --certificate="$intermediate_path" --from $user_account --yes)
165+
result=$(echo "$passphrase" | dcld tx pki add-x509-cert --certificate="$intermediate_path" --from $vendor_account --yes)
165166
check_response "$result" "\"code\": 0"
166167
echo "$result"
167168

168169
test_divider
169170

170-
echo "$trustee_account (Trustee) add Leaf certificate"
171+
echo "$vendor_account (Vendor) add Leaf certificate"
171172
leaf_path="integration_tests/constants/leaf_cert"
172-
result=$(echo "$passphrase" | dcld tx pki add-x509-cert --certificate="$leaf_path" --from $trustee_account --yes)
173+
result=$(echo "$passphrase" | dcld tx pki add-x509-cert --certificate="$leaf_path" --from $vendor_account --yes)
173174
check_response "$result" "\"code\": 0"
174175
echo "$result"
175176

176177
test_divider
177178

178-
echo "$trustee_account (Trustee) revokes Leaf certificate."
179-
result=$(echo "$passphrase" | dcld tx pki revoke-x509-cert --subject="$leaf_cert_subject" --subject-key-id="$leaf_cert_subject_key_id" --from=$trustee_account --yes)
179+
echo "$vendor_account (Vendor) revokes Leaf certificate."
180+
result=$(echo "$passphrase" | dcld tx pki revoke-x509-cert --subject="$leaf_cert_subject" --subject-key-id="$leaf_cert_subject_key_id" --from=$vendor_account --yes)
180181
check_response "$result" "\"code\": 0"
181182
echo "$result"
182183

integration_tests/upgrade/test-upgrade-0.12-to-1.2.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1139,13 +1139,13 @@ check_response "$result" "\"code\": 0"
11391139
test_divider
11401140

11411141
echo "Add intermediate_cert"
1142-
result=$(echo $passphrase | $DCLD_BIN_NEW tx pki add-x509-cert --certificate="$intermediate_cert_path_new" --from=$trustee_account_1 --yes)
1142+
result=$(echo $passphrase | $DCLD_BIN_NEW tx pki add-x509-cert --certificate="$intermediate_cert_path_new" --from=$vendor_account --yes)
11431143
check_response "$result" "\"code\": 0"
11441144

11451145
test_divider
11461146

11471147
echo "Revoke intermediate_cert"
1148-
result=$(echo $passphrase | $DCLD_BIN_NEW tx pki revoke-x509-cert --subject="$intermediate_cert_subject_new" --subject-key-id="$intermediate_cert_subject_key_id_new" --from=$trustee_account_1 --yes)
1148+
result=$(echo $passphrase | $DCLD_BIN_NEW tx pki revoke-x509-cert --subject="$intermediate_cert_subject_new" --subject-key-id="$intermediate_cert_subject_key_id_new" --from=$vendor_account --yes)
11491149
check_response "$result" "\"code\": 0"
11501150

11511151
test_divider

integration_tests/upgrade/test-upgrade-1.2-to-1.3.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ check_response "$result" "\"code\": 0"
473473
test_divider
474474

475475
echo "Add intermediate_cert"
476-
result=$(echo $passphrase | $DCLD_BIN_OLD tx pki add-x509-cert --certificate="$intermediate_cert_path" --from=$trustee_account_1 --yes)
476+
result=$(echo $passphrase | $DCLD_BIN_OLD tx pki add-x509-cert --certificate="$intermediate_cert_path" --from=$vendor_account --yes)
477477
check_response "$result" "\"code\": 0"
478478

479479
test_divider
@@ -1176,7 +1176,7 @@ check_response "$result" "\"code\": 0"
11761176
test_divider
11771177

11781178
echo "Add intermediate_cert"
1179-
result=$(echo $passphrase | $DCLD_BIN_NEW tx pki add-x509-cert --certificate="$intermediate_cert_path_new" --from=$trustee_account_1 --yes)
1179+
result=$(echo $passphrase | $DCLD_BIN_NEW tx pki add-x509-cert --certificate="$intermediate_cert_path_new" --from=$vendor_account --yes)
11801180
check_response "$result" "\"code\": 0"
11811181

11821182
test_divider
@@ -1188,7 +1188,7 @@ check_response "$result" "\"subjectKeyId\": \"$intermediate_cert_subject_key_id_
11881188
test_divider
11891189

11901190
echo "Revoke intermediate_cert"
1191-
result=$(echo $passphrase | $DCLD_BIN_NEW tx pki revoke-x509-cert --subject="$intermediate_cert_subject_new" --subject-key-id="$intermediate_cert_subject_key_id_new" --from=$trustee_account_1 --yes)
1191+
result=$(echo $passphrase | $DCLD_BIN_NEW tx pki revoke-x509-cert --subject="$intermediate_cert_subject_new" --subject-key-id="$intermediate_cert_subject_key_id_new" --from=$vendor_account --yes)
11921192
check_response "$result" "\"code\": 0"
11931193

11941194
test_divider

x/pki/handler_add_non_root_cert_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -503,23 +503,23 @@ func TestHandler_AddX509Cert_NonVIDScopedRoot(t *testing.T) {
503503
rootCertOptions *rootCertOptions
504504
childCert string
505505
childCertSubject string
506-
childCertSubjectKeyId string
506+
childCertSubjectKeyID string
507507
accountVid int32
508508
}{
509509
{
510510
name: "VidScopedChild",
511511
rootCertOptions: createPAACertNoVidOptions(testconstants.PAICertWithVidVid),
512512
childCert: testconstants.PAICertWithNumericVid,
513513
childCertSubject: testconstants.PAICertWithNumericVidSubject,
514-
childCertSubjectKeyId: testconstants.PAICertWithNumericVidSubjectKeyID,
514+
childCertSubjectKeyID: testconstants.PAICertWithNumericVidSubjectKeyID,
515515
accountVid: testconstants.PAICertWithVidVid,
516516
},
517517
{
518518
name: "NonVidScopedChild",
519519
rootCertOptions: createTestRootCertOptions(),
520520
childCert: testconstants.IntermediateCertPem,
521521
childCertSubject: testconstants.IntermediateSubject,
522-
childCertSubjectKeyId: testconstants.IntermediateSubjectKeyID,
522+
childCertSubjectKeyID: testconstants.IntermediateSubjectKeyID,
523523
accountVid: testconstants.Vid,
524524
},
525525
}
@@ -541,10 +541,10 @@ func TestHandler_AddX509Cert_NonVIDScopedRoot(t *testing.T) {
541541
// query certificate
542542
certs, _ := queryAllApprovedCertificates(setup)
543543
require.Equal(t, 2, len(certs))
544-
intermediateCerts, _ := queryApprovedCertificates(setup, tc.childCertSubject, tc.childCertSubjectKeyId)
544+
intermediateCerts, _ := queryApprovedCertificates(setup, tc.childCertSubject, tc.childCertSubjectKeyID)
545545
require.Equal(t, 1, len(intermediateCerts.Certs))
546546
require.Equal(t, tc.childCertSubject, intermediateCerts.Certs[0].Subject)
547-
require.Equal(t, tc.childCertSubjectKeyId, intermediateCerts.Certs[0].SubjectKeyId)
547+
require.Equal(t, tc.childCertSubjectKeyID, intermediateCerts.Certs[0].SubjectKeyId)
548548
})
549549
}
550550
}

x/pki/keeper/msg_server_add_x_509_cert.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ func (k msgServer) ensureCertsAndSenderVidMatch(
146146
signerAccount, _ := k.dclauthKeeper.GetAccountO(ctx, signerAddr)
147147
accountVID := signerAccount.VendorID
148148

149-
if rootVid != 0 {
149+
if rootVid != 0 { //nolint:nestif
150150
// If added under a VID scoped root CA:
151151
// Child certificate must be also VID scoped to the same VID as a root one
152152
if rootVid != childVid {

0 commit comments

Comments
 (0)