NebraLtd / hm-pyhelper

A helper module used across various Nebra repos to reduce redundant features.
https://nebra.io/hmpyhelper
MIT License
8 stars 16 forks source link

Bring gateway-mfr-rs up-to-date #164

Closed marvinmarnold closed 2 years ago

marvinmarnold commented 2 years ago

Related to: https://github.com/NebraLtd/hm-pyhelper/pull/148 To align with upstream, we need to upate gateway-mfr-rs, some parts of the api has changed. We can make it generic like helium. For that we might have to introduce following:

SWARM_KEY_URI eg "ecc://i2c-1:96?slot=0"

This contains all the information that we might need for swarm key or any other purpose. eg. type, bus, address, key slot. we can keep the old ECC_STORAGE_BUS for sometime.

Acceptance Criterion

posterzh commented 2 years ago

SWARM_KEY_URI format:

ecc:<dev>[:address][?slot=<slot>]

posterzh commented 2 years ago

On Rockpi miner.

1. To get the swarm key with gateway_mfr version 0.1.7:

$ /opt/python-dependencies/hm_pyhelper/gateway_mfr --path=/dev/i2c-7 key 0
{
  "key": "11YEpycWgugBctqFCC53QubjjeYrcv8wqTcwc2985FxVZoSF38M",
  "name": "formal-magenta-anteater",
  "slot": 0
}

Or

$ /opt/python-dependencies/hm_pyhelper/gateway_mfr --path=/dev/i2c-7 --address=96 key 0

2. To get the swarm key with gateway_mfr version 0.2.1:

$ /opt/python-dependencies/hm_pyhelper/gateway_mfr --device=ecc://i2c-7:96?slot=0 key
{
  "key": "11YEpycWgugBctqFCC53QubjjeYrcv8wqTcwc2985FxVZoSF38M",
  "name": "formal-magenta-anteater"
}

Or this can be abbreviated as

$ /opt/python-dependencies/hm_pyhelper/gateway_mfr --device=ecc://i2c-7:96 key

$ /opt/python-dependencies/hm_pyhelper/gateway_mfr --device=ecc://i2c-7 key
vpetersson commented 2 years ago

Given that we bundle gateway_mfr with this repo, we should be able to make this fully transactional.

posterzh commented 2 years ago

Related with https://github.com/NebraLtd/hm-pyhelper/pull/148

marvinmarnold commented 2 years ago

@posterzh can you recommend a way for us to validate that these changes are working in the fleet?

posterzh commented 2 years ago

@marvinmarnold Working diagnostics page is the obvious proof.

If get_public_keys_rust() is broken while developing, even the diagnostics service couldn't start.

marvinmarnold commented 2 years ago

Thanks @posterzh. @KevinWassermann94 can you work with Wayne to confirm the diagnostics page is showing the correct public key for devices running the newest release?

posterzh commented 2 years ago

@marvinmarnold @KevinWassermann94 The version of gateway_mfr_rs can only be checked in the SSH. Running /opt/python-dependencies/hm_pyhelper/gateway_mfr --version in the diagnostics console should give gateway_mfr 0.2.1 as the response.

KevinWassermann94 commented 2 years ago

@posterzh Thanks Zhang, good work! This is working