fix(core/thp): correct Failure_InvalidProtocol constant message#6549
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe PR adjusts the THP codec_v1 error response serialization: the failure payload length/type bytes for an InvalidProtocol Failure are changed from 0x14 to 0x02 in the encoded response. No public API signatures were modified and the handler's control flow (construct buffer, memcpy bytes, write packet) remains the same. Tests were updated to use a local expected Failure instance and to assert encoded output matches exactly, preventing trailing bytes. Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
| model | device_test | click_test | persistence_test |
|---|---|---|---|
| T2T1 | test(all) main(all) ![]() |
test(all) main(all) ![]() |
test(all) main(all) ![]() |
| T3B1 | test(all) main(all) ![]() |
test(all) main(all) ![]() |
test(all) main(all) ![]() |
| T3T1 | test(all) main(all) ![]() |
test(all) main(all) ![]() |
test(all) main(all) ![]() |
| T3W1 | test(all) main(all) ![]() |
test(all) main(all) ![]() |
test(all) main(all) ![]() |
Latest CI run: 22625299399
|
Seems to parse correctly by trezorlib in |
|
Yes - @szymonlesisz has found this issue when using a new parser (which didn't skip the trailing zero bytes). |
mmilata
left a comment
There was a problem hiding this comment.
LGTM, protoscope seems to agree. Will fix this in rust/trezor-thp.
53ac49c to
68406c3
Compare
|
Added a check in |




































Otherwise, the host will receive
b'\x08\x11' + b'\x00'*18.The trailing bytes are skipped by trezorlib, since our Python protobuf parser ignores unknown fields:
trezor-firmware/python/src/trezorlib/protobuf.py
Lines 443 to 453 in 53ac49c