py/bitbox02/communication: update protobuf generated files#951
py/bitbox02/communication: update protobuf generated files#951Beerosagos merged 1 commit intoBitBoxSwiss:masterfrom
Conversation
|
The protobuf files are generated by executing Please update the Dockerfile accordingly :) |
e1d1f7a to
af10ea0
Compare
Didn't think about that! :| Now should be ok, thanks. |
Are you sure it's HWI? The issue originally was this: So it was about the protobuf package being newer than 3.20. HWI's dep list uses 3.19.1. So maybe it was something else that upgraded your protobuf package 🤔 Anyway, would be good to include the above in the commit msg :) |
|
We have a problem maybe. When I now run send_message.py, I get: My local protobuf installation is at 3.19.4: Upgrading it fixes it, but that still means it's broken for protobuf <3.20. At the very least we need to then bump https://github.com/digitalbitbox/bitbox02-firmware/blob/57d62a98cf52fd4d700551083e925019e5eb16f3/py/bitbox02/setup.py#L78. Maybe that's sufficient 🤷 |
|
Please also update py/bitbox02/CHANGELOG.md under |
Thanks for pointing this out, didn't notice it! Yes, updating |
You are right, I was misled by the fact that both I and the user in #949 encountered the error while working on HWI. |
af10ea0 to
1fe857d
Compare
|
I am not really understanding why the CI failed. Made some tests on my local, but can't reproduce the error. |
I think pylint is just very bad with the member checks with protobuf, they are probably false positives. That's why you see so many You can lint it locally with |
|
Fyi the member check by pylint is not so important because we also have types everywhere, and mypy does a full type check on the package, so mypy would catch any such member mistakes. |
1fe857d to
88a5b7e
Compare
Thanks for the explanation. I disabled no-member checks for protobuf generated modules. |
benma
left a comment
There was a problem hiding this comment.
Could you update https://github.com/digitalbitbox/bitbox02-firmware/blob//.ci/run-container-ci#L28 to version 26? I just pushed the updated Docker image with the new protoc there.
I also accidentally overwrote the 25 tag on Docker hub - will re-build and re-push that one 🙈
py/bitbox02/CHANGELOG.md
Outdated
|
|
||
| ## 6.1.0 | ||
| - Add `eth_sign_typed_msg()` | ||
| - Update brotobuf dependency to >= 3.21 |
|
|
||
| [TYPECHECK] | ||
| # Ignore protobuf generated modules for no-member checks | ||
| ignored-modules=bitbox02.communication.generated.btc_pb2,bitbox02.communication.generated.cardano_pb2,bitbox02.communication.generated.common_pb2,bitbox02.communication.generated.eth_pb2,bitbox02.communication.generated.hww_pb2 |
There was a problem hiding this comment.
I couldn't figure out how to do this - thanks!!
There was a problem hiding this comment.
Please update the commit msg to explain this and that mypy does the member checks instead.
Recent protobuf versions (>=3.21) have compatibility issues with files generated with protoc < 3.19.0. This commit updates Dockerfile to install a recent version of protoc (3.21.2), updates generated protobuf files and increase Docker image version in `run-container-ci`. Since there is also a compatibility issue between protobuf files generated with protoc >= 3.19 and protobuf < 3.21, protobuf dependency of bitbox02 python library has been updated to >= 3.21. Protobuf generated modules have been excluded from pylint no-member checks, because of a large number of false-positive errors. A full type check is done on the package by mypy, anyway. It should be enough.
88a5b7e to
00d9788
Compare
| "hidapi>=0.7.99.post21", | ||
| "noiseprotocol>=0.3", | ||
| "protobuf>=3.7", | ||
| "protobuf>=3.21", |
There was a problem hiding this comment.
AFAICT protobuf 3.20.x is able to parse both the old and the new format
(while <3.20 can only parse the old format, and >=3.21 can only parse the new format)
Hence, would it not be better to set this to "protobuf>=3.20" ?
There was a problem hiding this comment.
If you also find this to be correct, please relax the requirement.
See spesmilo/electrum#7922
There was a problem hiding this comment.
Interesting, how did you figure this out? The release notes don't exactly give it away.
Anyway, we're happy to make a patch release that relaxes the constraint.
Fyi, protobuf>=3.20 requires Python 3.7, see also: bitcoin-core/HWI#626
There was a problem hiding this comment.
Interesting, how did you figure this out? The release notes don't exactly give it away.
When you have new protobuf and old generated files, the runtime error says
1. Downgrade the protobuf package to 3.20.x or lower..
I manually tested a bunch of protobuf versions from PyPI around that boundary, hoping some can parse both and to learn the behaviour.
I had tried reading the release notes first but could not make sense of them either :)
Fyi, protobuf>=3.20 requires Python 3.7, see also: bitcoin-core/HWI#626
That's fine. (in Electrum, we already bumped the minimum to Python 3.8)
EDIT:
Anyway, we're happy to make a patch release that relaxes the constraint.
Thanks, that would be great!
There was a problem hiding this comment.
6.1.1 is out, please give it a try.

Recent HWI update requires protobuf files generated with protoc =>
3.19.0. This update regenerates the files with protoc 3.21.1
EDIT: as @benma pointed out, the issue is not actually related to HWI, which currently requires protobuf 3.19.1.
The compatibility issue is between protobuf >= 3.21 and current protobuf files.
To solve it protobuf files has been regenerated with protoc >= 3.19 and protobuf dependency of bitbox02 py lib set to >= 3.21