Skip to content

Commit 552f505

Browse files
committed
Schema Changes to match 0.7 Chip Spec
Added Support for Device Versions and Vendor Info. p.s. TODO (Add some more test cases and updated documentation.)
1 parent 9ab0d85 commit 552f505

File tree

173 files changed

+7895
-3050
lines changed

Some content is hidden

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

173 files changed

+7895
-3050
lines changed

app.go

+43-13
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ import (
3434
"github.com/zigbee-alliance/distributed-compliance-ledger/x/compliance"
3535
"github.com/zigbee-alliance/distributed-compliance-ledger/x/compliancetest"
3636
"github.com/zigbee-alliance/distributed-compliance-ledger/x/genutil"
37-
"github.com/zigbee-alliance/distributed-compliance-ledger/x/modelinfo"
37+
"github.com/zigbee-alliance/distributed-compliance-ledger/x/model"
38+
"github.com/zigbee-alliance/distributed-compliance-ledger/x/modelversion"
3839
"github.com/zigbee-alliance/distributed-compliance-ledger/x/pki"
3940
"github.com/zigbee-alliance/distributed-compliance-ledger/x/validator"
41+
"github.com/zigbee-alliance/distributed-compliance-ledger/x/vendorinfo"
4042
)
4143

4244
const appName = "dc-ledger"
@@ -54,10 +56,12 @@ var ModuleBasics = module.NewBasicManager(
5456
auth.AppModuleBasic{},
5557
validator.AppModuleBasic{},
5658
genutil.AppModuleBasic{},
57-
modelinfo.AppModuleBasic{},
59+
model.AppModuleBasic{},
60+
modelversion.AppModuleBasic{},
5861
compliance.AppModuleBasic{},
5962
compliancetest.AppModuleBasic{},
6063
pki.AppModuleBasic{},
64+
vendorinfo.AppModuleBasic{},
6165
)
6266

6367
// MakeCodec generates the necessary codecs for Amino.
@@ -82,10 +86,12 @@ type dcLedgerApp struct {
8286
// Keepers
8387
authKeeper auth.Keeper
8488
validatorKeeper validator.Keeper
85-
modelinfoKeeper modelinfo.Keeper
89+
modelKeeper model.Keeper
90+
modelversionKeeper modelversion.Keeper
8691
pkiKeeper pki.Keeper
8792
complianceKeeper compliance.Keeper
8893
compliancetestKeeper compliancetest.Keeper
94+
vendorinfoKeeper vendorinfo.Keeper
8995

9096
// Module Manager
9197
mm *module.Manager
@@ -102,7 +108,7 @@ func NewDcLedgerApp(logger log.Logger, db dbm.DB, baseAppOptions ...func(*bam.Ba
102108
bApp.SetAppVersion(version.Version)
103109

104110
keys := sdk.NewKVStoreKeys(bam.MainStoreKey, auth.StoreKey, validator.StoreKey,
105-
modelinfo.StoreKey, compliance.StoreKey, compliancetest.StoreKey, pki.StoreKey)
111+
model.StoreKey, modelversion.StoreKey, compliance.StoreKey, compliancetest.StoreKey, pki.StoreKey, vendorinfo.StoreKey)
106112

107113
tkeys := sdk.NewTransientStoreKeys(params.TStoreKey)
108114

@@ -148,10 +154,12 @@ func InitModuleManager(app *dcLedgerApp) {
148154
genutil.NewAppModule(app.authKeeper, app.validatorKeeper, app.BaseApp.DeliverTx),
149155
auth.NewAppModule(app.authKeeper),
150156
validator.NewAppModule(app.validatorKeeper, app.authKeeper),
151-
modelinfo.NewAppModule(app.modelinfoKeeper, app.authKeeper),
152-
compliance.NewAppModule(app.complianceKeeper, app.modelinfoKeeper, app.compliancetestKeeper, app.authKeeper),
153-
compliancetest.NewAppModule(app.compliancetestKeeper, app.authKeeper, app.modelinfoKeeper),
157+
model.NewAppModule(app.modelKeeper, app.authKeeper),
158+
modelversion.NewAppModule(app.modelversionKeeper, app.authKeeper, app.modelKeeper),
159+
compliance.NewAppModule(app.complianceKeeper, app.modelversionKeeper, app.compliancetestKeeper, app.authKeeper),
160+
compliancetest.NewAppModule(app.compliancetestKeeper, app.authKeeper, app.modelversionKeeper),
154161
pki.NewAppModule(app.pkiKeeper, app.authKeeper),
162+
vendorinfo.NewAppModule(app.vendorinfoKeeper, app.authKeeper),
155163
)
156164

157165
app.mm.SetOrderBeginBlockers(validator.ModuleName)
@@ -160,10 +168,12 @@ func InitModuleManager(app *dcLedgerApp) {
160168
app.mm.SetOrderInitGenesis(
161169
auth.ModuleName,
162170
validator.ModuleName,
163-
modelinfo.ModuleName,
171+
model.ModuleName,
172+
modelversion.ModuleName,
164173
compliance.ModuleName,
165174
compliancetest.ModuleName,
166175
pki.ModuleName,
176+
vendorinfo.ModuleName,
167177
genutil.ModuleName,
168178
)
169179

@@ -175,8 +185,11 @@ func InitKeepers(app *dcLedgerApp, keys map[string]*sdk.KVStoreKey) {
175185
// The Validator keeper
176186
app.validatorKeeper = MakeValidatorKeeper(keys, app)
177187

178-
// The ModelinfoKeeper keeper
179-
app.modelinfoKeeper = MakeModelinfoKeeper(keys, app)
188+
// The ModelKeeper keeper
189+
app.modelKeeper = MakeModelKeeper(keys, app)
190+
191+
// The ModelversionKeeper keeper
192+
app.modelversionKeeper = MakeModelversionKeeper(keys, app)
180193

181194
// The ComplianceKeeper keeper
182195
app.complianceKeeper = MakeComplianceKeeper(keys, app)
@@ -189,6 +202,9 @@ func InitKeepers(app *dcLedgerApp, keys map[string]*sdk.KVStoreKey) {
189202

190203
// The AuthKeeper keeper
191204
app.authKeeper = MakeAuthKeeper(keys, app)
205+
206+
// The Vendor keeper
207+
app.vendorinfoKeeper = MakeVendorInfoKeeper(keys, app)
192208
}
193209

194210
func MakeAuthKeeper(keys map[string]*sdk.KVStoreKey, app *dcLedgerApp) auth.Keeper {
@@ -198,9 +214,23 @@ func MakeAuthKeeper(keys map[string]*sdk.KVStoreKey, app *dcLedgerApp) auth.Keep
198214
)
199215
}
200216

201-
func MakeModelinfoKeeper(keys map[string]*sdk.KVStoreKey, app *dcLedgerApp) modelinfo.Keeper {
202-
return modelinfo.NewKeeper(
203-
keys[modelinfo.StoreKey],
217+
func MakeModelKeeper(keys map[string]*sdk.KVStoreKey, app *dcLedgerApp) model.Keeper {
218+
return model.NewKeeper(
219+
keys[model.StoreKey],
220+
app.cdc,
221+
)
222+
}
223+
224+
func MakeModelversionKeeper(keys map[string]*sdk.KVStoreKey, app *dcLedgerApp) modelversion.Keeper {
225+
return modelversion.NewKeeper(
226+
keys[modelversion.StoreKey],
227+
app.cdc,
228+
)
229+
}
230+
231+
func MakeVendorInfoKeeper(keys map[string]*sdk.KVStoreKey, app *dcLedgerApp) vendorinfo.Keeper {
232+
return vendorinfo.NewKeeper(
233+
keys[vendorinfo.StoreKey],
204234
app.cdc,
205235
)
206236
}

deployment/persistent_chains/testnet/genesis.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@
9090
}
9191
]
9292
},
93-
"modelinfo": {
94-
"model_info_records": []
93+
"model": {
94+
"model_records": []
9595
},
9696
"compliance": {
9797
"compliance_model_records": []

docs/cli-help.md

+56-30
Original file line numberDiff line numberDiff line change
@@ -393,91 +393,117 @@ The set of commands that allows you to manage model infos.
393393

394394
Role: `Vendor`
395395

396-
Command: `dclcli tx modelinfo add-model --vid=<uint16> --pid=<uint16> --name=<string> --description=<string or path> --sku=<string>
397-
--firmware-version=<string> --hardware-version=<string> --tis-or-trp-testing-completed=<bool> --from=<account>`
396+
Command: `dclcli tx model add-model --vid=<uint16> --pid=<uint16> --productName=<string> --productLabel=<string or path> --sku=<string>
397+
--softwareVersion=<uint32> --softwareVersionString=<string> --hardwareVersion=<uint32> --hardwareVersionString=<string> --cdVersionNumber=<uint16>
398+
--from=<account>`
398399

399400
Flags:
400401
- vid: `uint16` - model vendor ID (positive non-zero)
401402
- pid: `uint16` - model product ID (positive non-zero)
402403
- name: `string` - model name
403404
- description: `string` - model description (string or path to file containing data)
404405
- sku: `string` - stock keeping unit
405-
- firmware-version: `string` - version of model firmware
406-
- hardware-version: `string` - version of model hardware
407-
- tis-or-trp-testing-completed: `bool` - whether model has successfully completed TIS/TRP testing
406+
- softwareVersion: `uint32` - Software Version of model (uint32)
407+
- softwareVersionString: `string` - Software Version String of model
408+
- hardwareVersion: `uint32` - version of model hardware
409+
- hardwareVersionString: `string` - Hardware Version String of model
410+
- cdVersionNumber: `uint32` - CD Version Number of the Certification
408411
- from: `string` - Name or address of private key with which to sign
409412
- cid: `optional(uint16)` - model category ID (positive non-zero)
410-
- custom: `optional(string)` - custom information (string or path to file containing data)
411-
- ota-url: `optional(string)` - the URL of the OTA
412-
- ota-checksum: `optional(string)` - the checksum of the OTA
413-
- ota-checksum-type: `optional(string)` - the type of the OTA checksum
414-
415-
Example: `dclcli tx modelinfo add-model --vid=1 --pid=1 --name="Device #1" --description="Device Description" --sku="SKU12FS" --firmware-version="1.0" --hardware-version="2.0" --tis-or-trp-testing-completed=true "--from=jack`
416-
417-
Example: `dclcli tx modelinfo add-model --vid=1 --pid=1 --name="Device #1" --description="Device Description" --sku="SKU12FS" --firmware-version="1.0" --hardware-version="2.0" --tis-or-trp-testing-completed=true --from=jack --cid=1 --custom="Some Custom information" --ota-url="http://my-ota.com" --ota-checksum="df56hf" --ota-checksum-type="SHA-256"`
413+
- revoked: `optional(bool)` - boolean flag to revoke the model
414+
- otaURL: `optional(string)` - the URL of the OTA
415+
- otaChecksum: `optional(string)` - the checksum of the OTA
416+
- otaChecksumType: `optional(string)` - the type of the OTA checksum
417+
- otaBlob: `optional(string)` - metadata about OTA
418+
- commissioningCustomFlow: `optional(uint8)` - A value of 1 indicates that user interaction with the device (pressing a button, for example) is required before commissioning can take place. When CommissioningCustomflow is set to a value of 2, the commissioner SHOULD attempt to obtain a URL which MAY be used to provide an end-user with the necessary details for how to configure the product for initial commissioning
419+
- commissioningCustomFlowURL: `optional(string)` - commissioningCustomFlowURL SHALL identify a vendor specific commissioning URL for the device model when the commissioningCustomFlow field is set to '2'
420+
- commissioningModeInitialStepsHint: `optional(uint32)` - commissioningModeInitialStepsHint SHALL identify a hint for the steps that can be used to put into commissioning mode a device that has not yet been commissioned. This field is a bitmap with values defined in the Pairing Hint Table. For example, a value of 1 (bit 0 is set) indicates that a device that has not yet been commissioned will enter Commissioning Mode upon a power cycle.
421+
- commissioningModeInitialStepsInstruction: `optional(string)` - commissioningModeInitialStepsInstruction SHALL contain text which relates to specific values of CommissioningModeInitialStepsHint. Certain values of CommissioningModeInitialStepsHint, as defined in the Pairing Hint Table, indicate a Pairing Instruction (PI) dependency, and for these values the commissioningModeInitialStepsInstruction SHALL be set
422+
- commissioningModeSecondaryStepsHint: `optional(uint32)` - commissioningModeSecondaryStepsHint SHALL identify a hint for steps that can be used to put into commissioning mode a device that has already been commissioned. This field is a bitmap with values defined in the Pairing Hint Table. For example, a value of 4 (bit 2 is set) indicates that a device that has already been commissioned will require the user to visit a current CHIP Administrator to put the device into commissioning mode.
423+
- commissioningModeSecondaryStepInstruction: `optional(string)` - commissioningModeSecondaryStepInstruction SHALL contain text which relates to specific values of commissioningModeSecondaryStepsHint. Certain values of commissioningModeSecondaryStepsHint, as defined in the Pairing Hint Table, indicate a Pairing Instruction (PI) dependency, and for these values the commissioningModeSecondaryStepInstruction SHALL be set
424+
- releaseNotesURL: `optional(string)` - URL that contains product specific web page that contains release notes for the device model.
425+
- userManualURL: `optional(string)` - URL that contains product specific web page that contains user manual for the device model.
426+
- supportURL: `optional(string)` - URL that contains product specific web page that contains support details for the device model.
427+
- productURL: `optional(string)` - URL that contains product specific web page that contains details for the device model.
428+
- chipBlob: `optional(string)` - chipBlob SHALL identify CHIP specific configurations
429+
- vendorBlob: `optional(string)` - field for vendors to provide any additional metadata about the device model using a string, blob, or URL.
430+
431+
432+
Example: `dclcli tx model add-model --vid=1 --pid=1 --productName="Device #1" --productLabel="Device Description" --sku="SKU12FS" --softwareVersion="10123" --softwareVersionString="1.0b123" --hardwareVersion="5123" --hardwareVersionString="5.1.23" --cdVersionNumber="32" --from="jack"`
433+
434+
Example: `dclcli tx model add-model --vid=1 --pid=1 --productName="Device #1" --productLabel="Device Description" --sku="SKU12FS" --softwareVersion="10123" --softwareVersionString="1.0b123" --hardwareVersion="5123" --hardwareVersionString="5.1.23" --cdVersionNumber="32" --cid=1 --custom="Some Custom information" --otaURL="http://my-ota.com" --otaChecksum="df56hf" --otaChecksumType="SHA-256" --from=jack `
418435

419436
- Update an existing model info. Only the owner can edit a Model Info.
420437

421438
Role: `Vendor`
422439

423-
Command: `dclcli tx modelinfo update-model --vid=<uint16> --pid=<uint16> --tis-or-trp-testing-completed=<bool> --from=<account>`
424-
existing ModelInfo.
440+
Command: `dclcli tx model update-model --vid=<uint16> --pid=<uint16> --from=<account>`
441+
existing Model.
425442

426443
Flags:
427444
- vid: `uint16` - model vendor ID
428445
- pid: `uint16` - model product ID
429-
- tis-or-trp-testing-completed: `bool` - whether model has successfully completed TIS/TRP testing
446+
- description: `string` - model description (string or path to file containing data)
447+
- cdVersionNumber: `uint32` - CD Version Number of the Certification
430448
- from: `string` - Name or address of private key with which to sign
431-
- description: `optional(string)` - model description (string or path to file containing data)
432-
- cid: `optional(uint16)` - model category ID
433-
- custom: `optional(string)` - custom information (string or path to file containing data)
434-
- ota-url: `optional(string)` - a new OTA URL. Can be edited only if `OTA_checksum` and `OTA_checksum_type` are already set.
449+
- revoked: `optional(bool)` - boolean flag to revoke the model
450+
- otaURL: `optional(string)` - the URL of the OTA
451+
- otaChecksum: `optional(string)` - the checksum of the OTA
452+
- otaChecksumType: `optional(string)` - the type of the OTA checksum
453+
- otaBlob: `optional(string)` - metadata about OTA
454+
- commissioningCustomFlowURL: `optional(string)` - commissioningCustomFlowURL SHALL identify a vendor specific commissioning URL for the device model when the commissioningCustomFlow field is set to '2'
455+
- releaseNotesURL: `optional(string)` - URL that contains product specific web page that contains release notes for the device model.
456+
- userManualURL: `optional(string)` - URL that contains product specific web page that contains user manual for the device model.
457+
- supportURL: `optional(string)` - URL that contains product specific web page that contains support details for the device model.
458+
- productURL: `optional(string)` - URL that contains product specific web page that contains details for the device model.
459+
- chipBlob: `optional(string)` - chipBlob SHALL identify CHIP specific configurations
460+
- vendorBlob: `optional(string)` - field for vendors to provide any additional metadata about the device model using a string, blob, or URL.
435461

436-
Example: `dclcli tx modelinfo update-model --vid=1 --pid=1 --tis-or-trp-testing-completed=true --from=jack --description="New Description"`
462+
Example: `dclcli tx model update-model --vid=1 --pid=1 --cdVersionNumber="32" --productLabel="New Description" --from=jack `
437463

438-
Example: `dclcli tx modelinfo update-model --vid=1 --pid=1 --tis-or-trp-testing-completed=true --from=jack --custom="Custom Data" --ota-url="http://new-ota.com"`
464+
Example: `dclcli tx model update-model --vid=1 --pid=1 --supportURL="https://product-support.url.test" --otaURL="http://new-ota.com" --from=jack `
439465

440466
##### Queries
441467
- Query a single model info.
442468

443-
Command: `dclcli query modelinfo model --vid=<uint16> --pid=<uint16>`
469+
Command: `dclcli query model get-model --vid=<uint16> --pid=<uint16>`
444470

445471
Flags:
446472
- vid: `uint16` - model vendor ID
447473
- pid: `uint16` - model product ID
448474

449-
Example: `dclcli query modelinfo model --vid=1 --pid=1`
475+
Example: `dclcli query model get-model --vid=1 --pid=1`
450476

451477
- Query a list of all model infos.
452478

453-
Command: `dclcli query modelinfo all-models`
479+
Command: `dclcli query model all-models`
454480

455481
Flags:
456482
- skip: `optional(int)` - number records to skip (`0` by default)
457483
- take: `optional(int)` - number records to take (all records are returned by default)
458484

459-
Example: `dclcli query modelinfo all-models`
485+
Example: `dclcli query model all-models`
460486

461487
- Query a list of all vendors.
462488

463-
Command: `dclcli query modelinfo vendors`
489+
Command: `dclcli query model vendors`
464490

465491
Flags:
466492
- skip: `optional(int)` - number records to skip (`0` by default)
467493
- take: `optional(int)` - number records to take (all records are returned by default)
468494

469-
Example: `dclcli query modelinfo vendors`
495+
Example: `dclcli query model vendors`
470496

471497
- Query a list of all model infos for the given vendor.
472498

473-
Command: `dclcli query modelinfo vendor-models --vid=<uint16>`
499+
Command: `dclcli query model vendor-models --vid=<uint16>`
474500

475501
Flags:
476502
- vid: `uint16` - model vendor ID
477503
- skip: `optional(int)` - number records to skip (`0` by default)
478504
- take: `optional(int)` - number records to take (all records are returned by default)
479505

480-
Example: `dclcli query modelinfo vendor-models --vid=1`
506+
Example: `dclcli query model vendor-models --vid=1`
481507

482508
### Compliance Test
483509

0 commit comments

Comments
 (0)