Skip to content

Commit 6f79d7f

Browse files
authored
Merge pull request #594 from zigbee-alliance/make-schema-version-zero
Issue #593: Add a (static) validation to all commands (in all tx.proto) so that if the input SchemaVersion != 0, the command is rejected.
2 parents bc16ad6 + 34bdf20 commit 6f79d7f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+570
-599
lines changed

docs/transactions.md

+14-14
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ Adds a record about a Vendor.
131131
- companyLegalName: `string` - Legal name of the vendor company
132132
- companyPreferredName: `optional(string)` - Preferred name of the vendor company
133133
- vendorLandingPageURL: `optional(string)` - URL of the vendor's landing page
134-
- schemaVersion: `optional(uint16)` - Schema version to support backward/forward compatability(default 0)
134+
- schemaVersion: `optional(uint16)` - Schema version to support backward/forward compatability. Should be equal to 0 (default 0)
135135
- In State: `vendorinfo/VendorInfo/value/<vid>`
136136
- Who can send:
137137
- Account with a vendor role who has the matching Vendor ID
@@ -151,7 +151,7 @@ Updates a record about a Vendor.
151151
- companyLegalName: `optional(string)` - Legal name of the vendor company
152152
- companyPreferredName: `optional(string)` - Preferred name of the vendor company
153153
- vendorLandingPageURL: `optional(string)` - URL of the vendor's landing page
154-
- schemaVersion: `optional(uint16)` - Schema version to support backward/forward compatability(default 0)
154+
- schemaVersion: `optional(uint16)` - Schema version to support backward/forward compatability. Should be equal to 0 (default 0)
155155
- In State: `vendorinfo/VendorInfo/value/<vid>`
156156
- Who can send:
157157
- Account with a vendor role who has the matching Vendor ID
@@ -220,7 +220,7 @@ Not all fields can be edited (see `EDIT_MODEL`).
220220
- enhancedSetupFlowTCDigest: `optional(string)` - enhancedSetupFlowTCDigest SHALL contain the digest of the entire contents of the associated file downloaded from the EnhancedSetupFlowTCUrl field, encoded in base64 string representation and SHALL be used to ensure the contents of the downloaded file are authentic. This field SHALL be present if and only if the EnhancedSetupFlowOptions field has bit 0 set.
221221
- enhancedSetupFlowTCFileSize: `optional(uint32)` - enhancedSetupFlowTCFileSize SHALL indicate the total size of the Enhanced Setup Flow Terms and Conditions file in bytes, and SHALL be used to ensure the downloaded file size is within the bounds of EnhancedSetupFlowTCFileSize. This field SHALL be present if and only if the EnhancedSetupFlowOptions field has bit 0 set.
222222
- maintenanceUrl: `optional(string)` - maintenanceUrl SHALL identify a link to a vendor-specific URL which SHALL provide a manufacturer specific means to resolve any functionality limitations indicated by the TERMS_AND_CONDITIONS_CHANGED status code. This field SHALL be present if and only if the EnhancedSetupFlowOptions field has bit 0 set.
223-
- schemaVersion: `optional(uint16)` - Schema version to support backward/forward compatability(default 1)
223+
- schemaVersion: `optional(uint16)` - Schema version to support backward/forward compatability. Should be equal to 0 (default 0)
224224
- In State:
225225
- `model/Model/value/<vid>/<pid>`
226226
- `model/VendorProducts/value/<vid>`
@@ -276,7 +276,7 @@ If one of EnhancedSetupFlow or MaintenanceUrl fields needs to be updated, ALL En
276276
- enhancedSetupFlowTCDigest: `optional(string)` - enhancedSetupFlowTCDigest SHALL contain the digest of the entire contents of the associated file downloaded from the EnhancedSetupFlowTCUrl field, encoded in base64 string representation and SHALL be used to ensure the contents of the downloaded file are authentic. This field SHALL be present if and only if the EnhancedSetupFlowOptions field has bit 0 set.
277277
- enhancedSetupFlowTCFileSize: `optional(uint32)` - enhancedSetupFlowTCFileSize SHALL indicate the total size of the Enhanced Setup Flow Terms and Conditions file in bytes, and SHALL be used to ensure the downloaded file size is within the bounds of EnhancedSetupFlowTCFileSize. This field SHALL be present if and only if the EnhancedSetupFlowOptions field has bit 0 set.
278278
- maintenanceUrl: `optional(string)` - maintenanceUrl SHALL identify a link to a vendor-specific URL which SHALL provide a manufacturer specific means to resolve any functionality limitations indicated by the TERMS_AND_CONDITIONS_CHANGED status code. This field SHALL be present if and only if the EnhancedSetupFlowOptions field has bit 0 set.
279-
- schemaVersion: `optional(uint16)` - Schema version to support backward/forward compatability(default 1)
279+
- schemaVersion: `optional(uint16)` - Schema version to support backward/forward compatability. Should be equal to 0 (default 0)
280280
- In State: `model/Model/value/<vid>/<pid>`
281281
- Who can send:
282282
- Vendor account associated with the same vid who has created the model
@@ -327,7 +327,7 @@ If one of `OTA_URl`, `OTA_checksum` or `OTA_checksum_type` fields is set, then t
327327
- otaChecksum `optional(string)` - Digest of the entire contents of the associated OTA Software Update Image under the OtaUrl attribute, encoded in base64 string representation. The digest SHALL have been computed using the algorithm specified in OtaChecksumType
328328
- otaChecksumType `optional(string)` - Numeric identifier as defined in IANA Named Information Hash Algorithm Registry for the type of otaChecksum. For example, a value of 1 would match the sha-256 identifier, which maps to the SHA-256 digest algorithm
329329
- releaseNotesURL `optional(string)` - URL that contains product specific web page that contains release notes for the device model.
330-
- schemaVersion: `optional(uint16)` - Schema version to support backward/forward compatability(default 0)
330+
- schemaVersion: `optional(uint16)` - Schema version to support backward/forward compatability. Should be equal to 0 (default 0)
331331
- In State:
332332
- `model/ModelVersion/value/<vid>/<pid>/<softwareVersion>`
333333
- `model/ModelVersions/value/<vid>/<pid>`
@@ -374,7 +374,7 @@ All non-edited fields remain the same.
374374
- otaURL `optional(string)` - URL where to obtain the OTA image
375375
- otaFileSize `optional(string)` - OtaFileSize is the total size of the OTA software image in bytes
376376
- otaChecksum `optional(string)` - Digest of the entire contents of the associated OTA Software Update Image under the OtaUrl attribute, encoded in base64 string representation. The digest SHALL have been computed using the algorithm specified in OtaChecksumType
377-
- schemaVersion: `optional(uint16)` - Schema version to support backward/forward compatability(default 0)
377+
- schemaVersion: `optional(uint16)` - Schema version to support backward/forward compatability. Should be equal to 0 (default 0)
378378

379379
- In State: `model/ModelVersion/value/<vid>/<pid>/<softwareVersion>`
380380
- Who can send:
@@ -512,7 +512,7 @@ from the revocation list.
512512
- transport `optional(string)` - optional field describing the transport
513513
- parentChild `optional(string)` - optional field describing the parent/child - Currently 'parent' and 'child' types are supported
514514
- certificationIDOfSoftwareComponent `optional(string)` - optional field describing the certification ID of software component
515-
- schemaVersion: `optional(uint16)` - Schema version to support backward/forward compatability(default 0)
515+
- schemaVersion: `optional(uint16)` - Schema version to support backward/forward compatability. Should be equal to 0 (default 0)
516516
- In State:
517517
- `compliance/ComplianceInfo/value/<vid>/<pid>/<softwareVersion>/<certificationType>`
518518
- `compliance/CertifiedModel/value/<vid>/<pid>/<softwareVersion>/<certificationType>`
@@ -550,7 +550,7 @@ Updates a compliance info by VID, PID, Software Version and Certification Type.
550550
- transport `optional(string)` - optional field describing the transport
551551
- parentChild `optional(string)` - optional field describing the parent/child - Currently 'parent' and 'child' types are supported
552552
- certificationIDOfSoftwareComponent `optional(string)` - optional field describing the certification ID of software component
553-
- schemaVersion: `optional(uint16)` - Schema version to support backward/forward compatability(default 0)
553+
- schemaVersion: `optional(uint16)` - Schema version to support backward/forward compatability. Should be equal to 0 (default 0)
554554
- Who can send:
555555
- CertificationCenter
556556
- CLI command:
@@ -598,7 +598,7 @@ is written on the ledger (`CERTIFY_MODEL` was called), or
598598
- revocationDate: `string` - The date of model revocation (rfc3339 encoded), for example 2019-10-12T07:20:50.52Z
599599
- certificationType: `string` - Certification type - Currently 'zigbee' and 'matter', 'access control', 'product security' types are supported
600600
- reason `optional(string)` - optional comment describing the reason of revocation
601-
- schemaVersion: `optional(uint16)` - Schema version to support backward/forward compatability(default 0)
601+
- schemaVersion: `optional(uint16)` - Schema version to support backward/forward compatability. Should be equal to 0 (default 0)
602602
- In State:
603603
- `compliance/ComplianceInfo/value/<vid>/<pid>/<softwareVersion>/<certificationType>`
604604
- `compliance/RevokedModel/value/<vid>/<pid>/<softwareVersion>/<certificationType>`
@@ -638,7 +638,7 @@ Can not be set if there is already a certification record on the ledger (certifi
638638
- transport `optional(string)` - optional field describing the transport
639639
- parentChild `optional(string)` - optional field describing the parent/child - Currently 'parent' and 'child' types are supported
640640
- certificationIDOfSoftwareComponent `optional(string)` - optional field describing the certification ID of software component
641-
- schemaVersion: `optional(uint16)` - Schema version to support backward/forward compatability(default 0)
641+
- schemaVersion: `optional(uint16)` - Schema version to support backward/forward compatability. Should be equal to 0 (default 0)
642642
- In State:
643643
- `compliance/ComplianceInfo/value/<vid>/<pid>/<softwareVersion>/<certificationType>`
644644
- `compliance/ProvisionalModel/value/<vid>/<pid>/<softwareVersion>/<certificationType>`
@@ -864,7 +864,7 @@ The PAA certificate is immutable. It can only be revoked by either the owner or
864864
- info: `optional(string)` - information/notes for the proposal. Can contain up to 4096 characters.
865865
- time: `optional(int64)` - proposal time (number of nanoseconds elapsed since January 1, 1970 UTC). This field cannot be specified using a CLI command and will use the current time by default.
866866
- vid: `uint16` - Vendor ID (positive non-zero). Must be equal to the Certificate's `vid` field for VID-scoped PAA.
867-
- schemaVersion: `optional(uint16)` - Certificate's schema version to support backward/forward compatability(default 0)
867+
- schemaVersion: `optional(uint16)` - Certificate's schema version to support backward/forward compatability. Should be equal to 0 (default 0)
868868
- In State: `pki/ProposedCertificate/value/<Certificate's Subject>/<Certificate's Subject Key ID>`
869869
- CLI command:
870870
- `dcld tx pki propose-add-x509-root-cert --certificate=<string-or-path> --from=<account>`
@@ -1045,7 +1045,7 @@ and DACs (leaf certificates) added to DCL if they are revoked in the CRL identif
10451045
- dataDigest: `optional(string)` - Digest of the entire contents of the associated file downloaded from the DataUrl. Must be omitted if RevocationType is 1. Must be provided if and only if the `DataFileSize` field is present.
10461046
- dataDigestType: `optional(uint32)` - The type of digest used in the DataDigest field from the list of [1, 7, 8, 10, 11, 12] (IANA Named Information Hash Algorithm Registry). Must be provided if and only if the `DataDigest` field is present.
10471047
- revocationType: `uint32` - The type of file found at the DataUrl for this entry. Supported types: 1 - RFC5280 Certificate Revocation List (CRL).
1048-
- schemaVersion: `optional(uint16)` - Schema version to support backward/forward compatibility (default is 1, the minimum value should be greater than or equal to 1)
1048+
- schemaVersion: `optional(uint16)` - Schema version to support backward/forward compatibility. Should be equal to 0 (default 0)
10491049
- In State:
10501050
- `pki/RevocationDistributionPoint/value/<IssuerSubjectKeyID>` -> list of Revocation Distribution Points
10511051
- `pki/RevocationDistributionPoint/value/<IssuerSubjectKeyID>/<vid>/<label>`-> Revocation Distribution Point
@@ -1073,7 +1073,7 @@ Updates an existing PKI Revocation distribution endpoint (such as RFC5280 Certif
10731073
- dataFileSize: `optional(uint64)` - Total size in bytes of the file found at the DataUrl. Must be omitted if RevocationType is 1.
10741074
- dataDigest: `optional(string)` - Digest of the entire contents of the associated file downloaded from the DataUrl. Must be omitted if RevocationType is 1. Must be provided if and only if the `DataFileSize` field is present.
10751075
- dataDigestType: `optional(uint32)` - The type of digest used in the DataDigest field from the list of [1, 7, 8, 10, 11, 12] (IANA Named Information Hash Algorithm Registry). Must be provided if and only if the `DataDigest` field is present.
1076-
- schemaVersion: `optional(uint16)` - Schema version to support backward/forward compatibility (default is 1, the minimum value should be greater than or equal to 1)
1076+
- schemaVersion: `optional(uint16)` - Schema version to support backward/forward compatibility. Should be equal to 0 (default 0)
10771077
- In State:
10781078
- `pki/RevocationDistributionPoint/value/<IssuerSubjectKeyID>` -> list of Revocation Distribution Points
10791079
- `pki/RevocationDistributionPoint/value/<IssuerSubjectKeyID>/<vid>/<label>` -> Revocation Distribution Point
@@ -1368,7 +1368,7 @@ This transaction adds a NOC root certificate (RCAC) owned by the Vendor.
13681368
- Vendor account
13691369
- Parameters:
13701370
- cert: `string` - The NOC Root Certificate (RCAC), encoded in X.509v3 PEM format. Can be a PEM string or a file path.
1371-
- schemaVersion: `optional(uint16)` - Certificate's schema version to support backward/forward compatability(default 0)
1371+
- schemaVersion: `optional(uint16)` - Certificate's schema version to support backward/forward compatability. Should be equal to 0 (default 0)
13721372
- In State:
13731373
- `pki/ApprovedCertificates/value/<Subject>/<SubjectKeyID>`
13741374
- `pki/ApprovedCertificatesBySubject/value/<Subject>`

integration_tests/cli/compliance-demo.sh

+4-6
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ matter_certification_type="matter"
4545
cd_certificate_id="123"
4646
cd_version_number=1
4747
schema_version_0=0
48-
schema_version_2=2
4948
echo "Certify unknown Model with VID: $vid PID: $pid SV: ${sv} with zigbee certification"
5049
result=$(echo "$passphrase" | dcld tx compliance certify-model --vid=$vid --pid=$pid --softwareVersion=$sv --softwareVersionString=$svs --certificationType="$zigbee_certification_type" --certificationDate="$certification_date" --cdCertificateId="$cd_certificate_id" --from $zb_account --yes)
5150
result=$(get_txn_result "$result")
@@ -189,7 +188,7 @@ check_response "$result" "ledger does not have matching CDVersionNumber=0: model
189188
test_divider
190189

191190
echo "Certify Model with VID: $vid PID: $pid SV: ${sv} with zigbee certification"
192-
result=$(echo "$passphrase" | dcld tx compliance certify-model --vid=$vid --pid=$pid --softwareVersion=$sv --softwareVersionString=$svs --certificationType="$zigbee_certification_type" --certificationDate="$certification_date" --cdCertificateId="$cd_certificate_id" --cdVersionNumber=$cd_version_number --schemaVersion=$schema_version_2 --from $zb_account --yes)
191+
result=$(echo "$passphrase" | dcld tx compliance certify-model --vid=$vid --pid=$pid --softwareVersion=$sv --softwareVersionString=$svs --certificationType="$zigbee_certification_type" --certificationDate="$certification_date" --cdCertificateId="$cd_certificate_id" --cdVersionNumber=$cd_version_number --schemaVersion=$schema_version_0 --from $zb_account --yes)
193192
result=$(get_txn_result "$result")
194193
echo "$result"
195194
check_response "$result" "\"code\": 0"
@@ -287,7 +286,7 @@ check_response "$result" "\"softwareVersionCertificationStatus\": 2"
287286
check_response "$result" "\"cDCertificateId\": \"$cd_certificate_id\""
288287
check_response "$result" "\"date\": \"$certification_date\""
289288
check_response "$result" "\"certificationType\": \"$zigbee_certification_type\""
290-
check_response "$result" "\"schemaVersion\": $schema_version_2"
289+
check_response "$result" "\"schemaVersion\": $schema_version_0"
291290
echo "$result"
292291

293292
test_divider
@@ -750,10 +749,9 @@ upd_supported_clusters="brand_new_clusters"
750749
upd_os_version="brand_new_os_version"
751750
upd_parent_child="parent"
752751
upd_certification_id_of_software_component="brand_new_component"
753-
schema_version_3=3
754752

755753
echo "Update Compliance Info for Model with VID: ${vid} PID: ${pid} SV: ${sv} for $zigbee_certification_type with all optional fields set"
756-
result=$(echo "$passphrase" | dcld tx compliance update-compliance-info --vid=$vid --pid=$pid --softwareVersion=$sv --certificationType=$zigbee_certification_type --cdVersionNumber=$upd_cd_version_number --certificationDate=$upd_certification_date --reason=$upd_reason --cdCertificateId=$upd_cd_certificate_id --certificationRoute=$upd_certification_route --programType=$upd_program_type --programTypeVersion=$upd_program_type_version --compliantPlatformUsed=$upd_compliant_platform_used --compliantPlatformVersion=$upd_compliant_platform_version --transport=$upd_transport --familyId=$upd_familyID --supportedClusters=$upd_supported_clusters --OSVersion=$upd_os_version --parentChild=$upd_parent_child --certificationIDOfSoftwareComponent=$upd_certification_id_of_software_component --schemaVersion=$schema_version_3 --from=$zb_account --yes)
754+
result=$(echo "$passphrase" | dcld tx compliance update-compliance-info --vid=$vid --pid=$pid --softwareVersion=$sv --certificationType=$zigbee_certification_type --cdVersionNumber=$upd_cd_version_number --certificationDate=$upd_certification_date --reason=$upd_reason --cdCertificateId=$upd_cd_certificate_id --certificationRoute=$upd_certification_route --programType=$upd_program_type --programTypeVersion=$upd_program_type_version --compliantPlatformUsed=$upd_compliant_platform_used --compliantPlatformVersion=$upd_compliant_platform_version --transport=$upd_transport --familyId=$upd_familyID --supportedClusters=$upd_supported_clusters --OSVersion=$upd_os_version --parentChild=$upd_parent_child --certificationIDOfSoftwareComponent=$upd_certification_id_of_software_component --schemaVersion=$schema_version_0 --from=$zb_account --yes)
757755
result=$(get_txn_result "$result")
758756
echo "$result"
759757

@@ -778,7 +776,7 @@ check_response "$result" "\"supportedClusters\": \"$upd_supported_clusters\""
778776
check_response "$result" "\"OSVersion\": \"$upd_os_version\""
779777
check_response "$result" "\"parentChild\": \"$upd_parent_child\""
780778
check_response "$result" "\"certificationIdOfSoftwareComponent\": \"$upd_certification_id_of_software_component\""
781-
check_response "$result" "\"schemaVersion\": $schema_version_3"
779+
check_response "$result" "\"schemaVersion\": $schema_version_0"
782780

783781

784782
test_divider

integration_tests/cli/compliance-provisioning.sh

+2-3
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,14 @@ provision_date="2020-02-02T02:20:20Z"
4141
provision_reason="some reason"
4242
cd_certificate_id="123"
4343
schema_version_0=0
44-
schema_version_2=2
4544

4645
test_divider
4746

4847
echo "Add Model and a New Model Version with VID: $vid PID: $pid SV: $sv"
4948
create_model_and_version $vid $pid $sv $svs $vendor_account
5049

5150
echo "Provision for uncertificate Model with VID: $vid PID: $pid for ZB"
52-
result=$(echo "$passphrase" | dcld tx compliance provision-model --vid=$vid --pid=$pid --softwareVersion=$sv --softwareVersionString=$svs --certificationType="$certification_type_zb" --provisionalDate="$provision_date" --reason "$provision_reason" --cdCertificateId="$cd_certificate_id" --cdVersionNumber=1 --schemaVersion=$schema_version_2 --from $zb_account --yes)
51+
result=$(echo "$passphrase" | dcld tx compliance provision-model --vid=$vid --pid=$pid --softwareVersion=$sv --softwareVersionString=$svs --certificationType="$certification_type_zb" --provisionalDate="$provision_date" --reason "$provision_reason" --cdCertificateId="$cd_certificate_id" --cdVersionNumber=1 --schemaVersion=$schema_version_0 --from $zb_account --yes)
5352
result=$(get_txn_result "$result")
5453
check_response "$result" "\"code\": 0"
5554
echo "$result"
@@ -154,7 +153,7 @@ check_response "$result" "\"cDCertificateId\": \"$cd_certificate_id\""
154153
check_response "$result" "\"date\": \"$provision_date\""
155154
check_response "$result" "\"reason\": \"$provision_reason\""
156155
check_response "$result" "\"certificationType\": \"$certification_type_zb\""
157-
check_response "$result" "\"schemaVersion\": $schema_version_2"
156+
check_response "$result" "\"schemaVersion\": $schema_version_0"
158157
check_response "$result" "\"history\""
159158
echo "$result"
160159

0 commit comments

Comments
 (0)