Skip to content

feat(core): reimplement THP retransmissions #5572

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 21, 2025
Merged

Conversation

romanz
Copy link
Contributor

@romanz romanz commented Aug 18, 2025

Rebased over #5546.

@trezor-bot trezor-bot bot added this to Firmware Aug 18, 2025
@github-project-automation github-project-automation bot moved this to 🔎 Needs review in Firmware Aug 18, 2025
Copy link

github-actions bot commented Aug 18, 2025

en main(all)

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: 17126022031

@romanz romanz force-pushed the romanz/thp-retransmissions branch from cffbc98 to d18f5d8 Compare August 18, 2025 08:46
@romanz romanz force-pushed the romanz/thp-retransmissions branch 2 times, most recently from 9cb5e13 to 65e587e Compare August 18, 2025 12:41
@romanz romanz changed the base branch from romanz/thp-refactor to main August 18, 2025 13:17
@romanz romanz changed the base branch from main to romanz/thp-refactor August 18, 2025 13:17
@romanz romanz force-pushed the romanz/thp-refactor branch from c428fb9 to 67ba964 Compare August 18, 2025 14:13
@romanz romanz force-pushed the romanz/thp-refactor branch from 47b0933 to f30b65d Compare August 19, 2025 06:46
@romanz romanz force-pushed the romanz/thp-retransmissions branch from 65e587e to 87bf847 Compare August 19, 2025 08:52
@romanz romanz marked this pull request as ready for review August 19, 2025 09:16
@romanz romanz requested a review from obrusvit as a code owner August 19, 2025 09:16
@romanz romanz requested a review from mmilata August 19, 2025 09:16
@romanz romanz self-assigned this Aug 19, 2025
@romanz romanz added the core Trezor Core firmware. Runs on Trezor Model T and Safe models. label Aug 19, 2025
@romanz romanz requested a review from M1nd3r August 20, 2025 08:03
@romanz romanz force-pushed the romanz/thp-refactor branch from f30b65d to efc2848 Compare August 20, 2025 08:04
@romanz romanz requested a review from TychoVrahe as a code owner August 20, 2025 08:04
@romanz
Copy link
Contributor Author

romanz commented Aug 20, 2025

Rebasing over #5546.

@romanz romanz removed the request for review from TychoVrahe August 20, 2025 08:11
@romanz romanz force-pushed the romanz/thp-retransmissions branch from 87bf847 to 7150c88 Compare August 20, 2025 08:11
@romanz romanz force-pushed the romanz/thp-refactor branch from efc2848 to 6213e3b Compare August 21, 2025 07:50
@romanz romanz force-pushed the romanz/thp-retransmissions branch from 7150c88 to b2bba6d Compare August 21, 2025 08:39
@romanz romanz force-pushed the romanz/thp-refactor branch from 6213e3b to 5d55e48 Compare August 21, 2025 10:24
@romanz romanz force-pushed the romanz/thp-retransmissions branch from b2bba6d to b0641b3 Compare August 21, 2025 11:02
@romanz
Copy link
Contributor Author

romanz commented Aug 21, 2025

Tested by running pytest tests/device_tests/bitcoin/test_signtx.py -k lots_of_outputs and manually SIGSTOP-ing it a few times:

19.603 trezor.wire.thp.channel INFO [WebUSB] (cid: 8201) write message: ButtonRequest
19.603 trezor.wire.thp.channel DEBUG [WebUSB] message contents:
ButtonRequest {
    name: 'confirm_output'
    code: 3
    pages: 1
}
19.603 trezor.wire.thp.channel DEBUG [WebUSB] (cid: 8201) encrypt
19.603 trezor.wire.thp.crypto DEBUG enc (key: 433aaade7a5828223634c22bf0a5b2e0bb814566042bf222e0e281693d355f54, nonce: 454)
19.603 trezor.wire.thp.channel DEBUG [WebUSB] (cid: 8201) New nonce_send: 455
19.603 trezor.wire.thp.channel DEBUG [WebUSB] (cid: 8201) write_encrypted_payload_loop
19.703 trezor.wire.thp.channel WARNING Retransmit after 100 ms
19.903 trezor.wire.thp.channel WARNING Retransmit after 200 ms
20.203 trezor.wire.thp.channel WARNING Retransmit after 298 ms
20.598 trezor.wire.thp.channel WARNING Retransmit after 394 ms
21.086 trezor.wire.thp.channel WARNING Retransmit after 488 ms
21.666 trezor.wire.thp.channel WARNING Retransmit after 581 ms
22.338 trezor.wire.thp.channel WARNING Retransmit after 672 ms
23.099 trezor.wire.thp.channel WARNING Retransmit after 761 ms
23.427 trezor.wire.thp.channel DEBUG [WebUSB] (cid: 8201) get_channel_state: ENCRYPTED_TRANSPORT
23.427 trezor.wire.thp.channel DEBUG [WebUSB] Received ACK message with correct ack bit
23.427 trezor.wire.thp.session_context DEBUG [WebUSB] Read - with expected types (27,) and expected type ButtonAck
23.427 trezor.wire.thp.channel DEBUG [WebUSB] (cid: 8201) get_channel_state: ENCRYPTED_TRANSPORT
23.427 trezor.wire.thp.channel DEBUG [WebUSB] Writing ACK message to a channel with cid: 8201, ack_bit: 0
23.427 trezor.wire.thp.channel DEBUG [WebUSB] (cid: 8201) Buffer before decryption: 793b68
23.427 trezor.wire.thp.crypto DEBUG dec (key: 71437e998a91502bac71cee7a28211c0221486302e4e882f5caa687221e70543, nonce: 454)
23.428 trezor.wire.thp.channel DEBUG [WebUSB] (cid: 8201) Buffer after decryption: 01001b
23.428 trezor.wire.thp.channel DEBUG [WebUSB] (cid: 8201) Is decrypted tag valid? True
23.428 trezor.wire.thp.channel DEBUG [WebUSB] (cid: 8201) Received tag: 0e5f0b96aa88e27460add78762a15b28
23.428 trezor.wire.thp.channel DEBUG [WebUSB] (cid: 8201) New nonce_receive: 455
23.428 trezor.wire.message_handler DEBUG Buffer to be parsed to a LoadedMessage: 
23.428 trezor.wire.message_handler DEBUG received message contents:
ButtonAck {}

Base automatically changed from romanz/thp-refactor to main August 21, 2025 11:46
@romanz romanz force-pushed the romanz/thp-retransmissions branch from b0641b3 to 3ca9525 Compare August 21, 2025 11:49
@romanz romanz merged commit 3ca9525 into main Aug 21, 2025
103 checks passed
@romanz romanz deleted the romanz/thp-retransmissions branch August 21, 2025 12:22
@github-project-automation github-project-automation bot moved this from 🔎 Needs review to 🤝 Needs QA in Firmware Aug 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Trezor Core firmware. Runs on Trezor Model T and Safe models.
Projects
Status: 🤝 Needs QA
Development

Successfully merging this pull request may close these issues.

3 participants