AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Informational 15 Bitcoin

refactor(core): use `async` function instead of a generator

Public commit record

What the developer wrote

Authored by Roman Zeyde

93/100 · Strong
refactor(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]
✓ 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
The short version

What changed, and why it matters

This 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.

Recommended action

No security action needed. This is a readability refactor with no functional or security impact.

Security signals we found

No strong security signals were identified.

Risk score

Why this scored 15/100

Our methodology →
Potential impact 0/30
Exploitability 0/25
Stealth signal 0/15
Affected reach 0/15
Confidence 10/10
Evidence quality 5/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.