Skip to content

Commit

Permalink
py/bitbox02: update protobuf deps and regenerate files.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Beerosagos committed Jul 19, 2022
1 parent dd320a7 commit 00d9788
Show file tree
Hide file tree
Showing 17 changed files with 330 additions and 5,539 deletions.
2 changes: 1 addition & 1 deletion .ci/run-container-ci
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
set -e
set -x

CONTAINER=shiftcrypto/firmware_v2:25
CONTAINER=shiftcrypto/firmware_v2:26

if [ "$1" == "pull" ] ; then
docker pull "$CONTAINER"
Expand Down
6 changes: 5 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@ docstring-min-length=10
[MESSAGES CONTROL]
# Black/pylint mismatch on code formatting
disable=bad-continuation, fixme, too-few-public-methods, duplicate-code, line-too-long, consider-using-f-string, too-many-locals, raise-missing-from, super-init-not-called, too-many-lines
good-names=i,j,tx
good-names=i,j,tx

[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
10 changes: 7 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
FROM ubuntu:18.04
ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update && apt-get upgrade -y && apt-get install -y wget nano rsync curl gnupg2 jq
RUN apt-get update && apt-get upgrade -y && apt-get install -y wget nano rsync curl gnupg2 jq unzip

# for clang-*-8, see https://apt.llvm.org/
RUN echo "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main" >> /etc/apt/sources.list && \
Expand Down Expand Up @@ -96,8 +96,12 @@ RUN python3 -m pip install --upgrade \
wheel==0.33.6 \
twine==1.15.0

# For protoc
RUN apt-get update && apt-get install -y protobuf-compiler
#Install protoc from release, because the version available on the repo is too old
RUN mkdir -p /opt/protoc && \
curl -L0 https://github.com/protocolbuffers/protobuf/releases/download/v21.2/protoc-21.2-linux-x86_64.zip -o /tmp/protoc-21.2-linux-x86_64.zip && \
unzip /tmp/protoc-21.2-linux-x86_64.zip -d /opt/protoc
ENV PATH /opt/protoc/bin:$PATH

# Make Python3 the default, so tools/nanopb/generator/*.py run with Python3.
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1

Expand Down
2 changes: 2 additions & 0 deletions py/bitbox02/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## 6.1.0
- Add `eth_sign_typed_msg()`
- Update protobuf dependency to >= 3.21
- Regenerate protobuf files with protoc v3.21.2

## 6.0.0
- Offset the recoverable ID by 27 in the signature returned by `eth_sign_msg()`.
Expand Down
148 changes: 15 additions & 133 deletions py/bitbox02/bitbox02/communication/generated/antiklepto_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 00d9788

Please sign in to comment.