Skip to content

fix(protocol): regenerate bindings with the canonical protoc (unblocks firmware integration CI) - #108

Merged
BitHighlander merged 7 commits into
alphafrom
fix/regenerate-bindings-canonical-protoc
Sep 19, 2026
Merged

BitHighlander merged 7 commits into
alphafrom
fix/regenerate-bindings-canonical-protoc

Conversation

@BitHighlander

Copy link
Copy Markdown
Owner

Firmware CI's python-integration-tests fails at import with ImportError: cannot import name 'builder'. The cause: 31d8c27 regenerated messages_pb2.py and messages_ethereum_pb2.py with a host protoc, producing builder-style code that needs protobuf >= 3.20. The integration container runs Python 3.6.9 with protobuf 3.17.3.

This PR regenerates both files with build_pb.sh inside the CI-pinned kktech/firmware@sha256:7438e539… image (protoc 3.5.1), the same way every earlier binding was built.

  • Serialized descriptors are byte-identical to the files they replace (same schema).
  • test_erc7730_protocol_bindings.py + test_message_signing_protocol_bindings.py: 8 passed on protobuf 3.17.3 (py3.6, CI image) and 3.20.3. Control: the current alpha files fail to import in the CI image.
  • setup.py: protobuf>=3.20.0 → >=3.17,<4, the range actually tested. protoc 3.5.1 output does not load on protobuf >= 4.21.

31d8c27 regenerated messages_pb2.py and messages_ethereum_pb2.py with a
host protoc (builder-style, needs protobuf >= 3.20) instead of
docker_build_pb.sh. The firmware integration container runs Python
3.6.9 / protobuf 3.17.3, so every python-integration-tests job failed
at import: "cannot import name 'builder'".

Regenerated via build_pb.sh inside the CI-pinned firmware image
(protoc 3.5.1). Serialized descriptors are byte-identical to the
builder files (messages 14590 B, ethereum 3046 B, types 4686 B).
test_erc7730_protocol_bindings + test_message_signing_protocol_bindings:
8 passed on protobuf 3.17.3 (py3.6, CI image) and 3.20.3. setup.py
range narrowed to what was tested: protoc-3.5.1 code does not load on
protobuf >= 4.21.
BitHighlander added a commit to BitHighlander/keepkey-firmware that referenced this pull request Sep 18, 2026
python-integration-tests failed at import on the CI image (py3.6 /
protobuf 3.17.3) because the pinned bindings were builder-style.
BitHighlander/python-keepkey#108 regenerates them with the canonical
protoc; descriptors are byte-identical.
The authoritative-network guard allowed loopback only. In firmware CI
the emulator is the compose service kkemu (KK_TRANSPORT_MAIN=
kkemu:11044), so all 616 emulator tests failed with 'attempted external
network access'. Allow exactly the KK_TRANSPORT_MAIN / KK_TRANSPORT_DEBUG
endpoints (and their resolved addresses), as the audit line does; every
other destination is still denied. test_tx_fixture_integrity: 5 passed.
- conftest: port pytest_collection_modifyitems from the audit line.
  Firmware CI passes KEEPKEY_SCREENSHOT_TESTS (188 report selectors); pyk
  alpha ignored it, so the screenshot phase ran all ~758 tests and the
  full-variant job hit its 30-minute limit.
- test_msg_zcash_transparent_shielding: bitcoin-only builds have no Zcash
  (KK_ZCASH_PRIVACY OFF) and answer "Unknown message"; skip the class
  there, closing the transport via addCleanup since skipTest in setUp
  bypasses tearDown.
Firmware alpha (6816915a3) replaced direct dice entry with a host-selected
mode and an on-device consent screen, then shows the device's 24 words
before any roll. That firmware pinned python-keepkey f00e62f; a later
re-pin to b44f1b3 (this alpha line) dropped the matching test, so
test_reset_device_dice acked the consent screen as roll input and the
device answered "Reset cancelled".

Rewrite the test body for consent -> device words -> rolls -> digest
confirm, and check the mnemonic against the published MIXED formula
(device words + rolls; EntropyAck bytes excluded). Seed helpers and the
requires_dice_modes capability gate come from f00e62f. Same test name,
same two captures the report declares.
Firmware refuses a 68-byte approve(spender, 2^256-1) with "Unlimited ERC20
approval is disabled" (release-line policy since 7.14.2). This alpha line
still expected signatures, so three tests failed on every full-variant run.
Take the audit-line versions (f00e62f) that assert the refusal:
test_approve_all, test_sign_uni_approve_liquidity_ETH, and the
erc20-approve-unlimited clear-sign flow. Adds common.firmware_at_least.
Firmware authenticates before showing the SignMessage confirm since
7.14.2; this alpha line still expected the old order. Take the audit-line
version (f00e62f), which gates the order on firmware_at_least.
@BitHighlander
BitHighlander merged commit 6ae6b01 into alpha Sep 19, 2026
2 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant