zigbee-alliance / distributed-compliance-ledger

DCL is a public permissioned ledger framework for certification of device models. The ledger is based on Cosmos SDK and CometBFT (Tendermint).
Apache License 2.0
89 stars 44 forks source link

#502 Add SchemaVersion field into PKI, Compliance, Model and VendorInfo schemas #552

Closed Abdulbois closed 8 months ago

akarabashov commented 8 months ago
  • I think we need to have schemaVersion for auxiliary models as well: Accounts, Validator, Update.

Created task: https://github.com/zigbee-alliance/distributed-compliance-ledger/issues/556

Abdulbois commented 8 months ago

As the new field is optional, and we have to manually pass it to the object constructor in every handler and every CLI command, there is a risk that we may unintentionally forget to pass it somewhere. So, I would recommend to add such tests for every command. Either have a dedicated/separate test where we explicitly set schema version for all add/update commands and check that it has been set/updated, or extend existing Add/Update tests. I know that we already have such tests for some transactions, I think it's important to have it for all of them.

Note: it seems such checks (that we pass and apply optional parameters correctly) may be duplicated in unit and CLI tests. Although usually we prefer unit tests, in this case we may consider having CLI tests only (as it implicitly covers the unit test cases as well).

I think, currently all txn CLI calls are checked for using schemaVersion in their commands To be sure will double check

Abdulbois commented 8 months ago

I noticed that unit tests for static validation are missing, I think it makes sense to add them

Added, please recheck