distributed-compliance-ledger icon indicating copy to clipboard operation
distributed-compliance-ledger copied to clipboard

Certificate declaration version number should be uint16

Open samadDotDev opened this issue 3 years ago • 0 comments

The certificate declaration version number is defined as uint16 in the Matter spec. This is pretty critical since the value is encoded as a smaller type in Certificate Declaration TLV:

certification-elements => STRUCTURE [ tag-order ]
{
    format_version [0]       : UNSIGNED INTEGER [ range 16-bits ]
    vendor_id [1]            : UNSIGNED INTEGER [ range 16-bits ]
    product_id_array [2]     : ARRAY [ length 1..100 ] OF UNSIGNED INTEGER [ range 16-bits ]
    device_type_id [3]       : UNSIGNED INTEGER [ range 32-bits ]
    certificate_id [4]       : STRING [ length 19 ]
    security_level [5]       : UNSIGNED INTEGER [ range 8-bits ]
    security_information [6] : UNSIGNED INTEGER [ range 16-bits ]
    version_number [7]       : UNSIGNED INTEGER [ range 16-bits ]
    certification_type [8]   : UNSIGNED INTEGER [ range 8-bits]
    dac_origin_vendor_id [9, optional]   : UNSIGNED INTEGER [ range 16-bits ]
    dac_origin_product_id [10, optional] : UNSIGNED INTEGER [ range 16-bits ]
    authorized_paa_list [11, optional]   : ARRAY [ length 1..10 ] OF OCTET STRING [ length 20 ]
}

On DCL however, it is declared as a mix of different types:

On the documentation, it is specified as uint32: https://github.com/zigbee-alliance/distributed-compliance-ledger/blob/master/docs/transactions.md#add_model_version

And the typescript / go syntax specifies it as int32:

https://github.com/zigbee-alliance/distributed-compliance-ledger/blob/d516d7152a5b70129d3b22c1612d06ca75e62b49/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.model/module/rest.d.ts#L36

https://github.com/zigbee-alliance/distributed-compliance-ledger/blob/d516d7152a5b70129d3b22c1612d06ca75e62b49/x/model/types/messages_model_version.go#L23

https://github.com/zigbee-alliance/distributed-compliance-ledger/blob/d516d7152a5b70129d3b22c1612d06ca75e62b49/x/model/client/cli/tx_model_version.go#L18

CC: @msandstedt, @Con-Tejus

samadDotDev avatar Dec 06 '22 17:12 samadDotDev