Commit message · Roman Zeyderefactor(core): use `async` function instead of a generator
Following https://satoshilabs.slack.com/archives/C054XGU77QV/p1777387713801909.
`yield from` and `await` both allocate, so let's use `await` for better readability.
Checked `core/build/firmware/frozen_mpy.c`, the same code is generated:
```
// child of trezor_wire_thp_channel_Channel_write_encrypted_payload
// frozen bytecode for file trezor/wire/thp/channel.py, scope trezor_wire_thp_channel_Channel_write_encrypted_payload__wait_for_ack
static const byte fun_data_trezor_wire_thp_channel_Channel_write_encrypted_payload__wait_for_ack[39] = {
0xa1,0x40,0x08, // prelude
0x81,0x1b,0x81,0x2d, // names: _wait_for_ack, *
// code info
0x42,0x4f, // JUMP 15
0x25,0x00, // LOAD_DEREF 0
0x14,0x74, // LOAD_METHOD 'recv_payload'
0x10,0x81,0x1c, // LOAD_CONST_STRING 'expected_ctrl_byte'
0x51, // LOAD_CONST_NONE
0x36,0x82,0x00, // CALL_METHOD 256
0x5e, // GET_ITER
0x51, // LOAD_CONST_NONE
0x68, // YIELD_FROM
0x59, // POP_TOP
0x12,0x81,0x1d, // LOAD_GLOBAL 'ABP'
0x14,0x7b, // LOAD_METHOD 'is_sending_allowed'
0x25,0x00, // LOAD_DEREF 0
0x13,0x45, // LOAD_ATTR 'channel_cache'
0x36,0x01, // CALL_METHOD 1
0x44,0x24, // POP_JUMP_IF_FALSE -28
0x51, // LOAD_CONST_NONE
0x63, // RETURN_VALUE
};
```
[no changelog]
93/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
AI analysis · Informational 15/100This commit is a pure code cleanup: it rewrites two small internal helper functions from Python generator style (`yield from`) to modern async/await style (`await`). The author verified that the compiled firmware bytecode is identical, meaning the device behaves exactly the same as before. There is no security-relevant change.