refactor(core/ethereum): simplify `sign_auth_eip7702()` digest flow
What changed, and why it matters
This commit is a small code cleanup in the Ethereum signing module for Trezor hardware wallets. It replaces a manual, step-by-step RLP (a data-encoding format used by Ethereum) header-and-field writing process with a single helper call that does the same thing. There is no indication of a security bug being fixed.
No security action required. Treat as routine refactoring; standard code review and regression testing are sufficient.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change refactors sign_auth_eip7702() in core/src/apps/ethereum/sign_auth_eip7702.py. Previously the code built an RLP list by manually summing field lengths, writing a list header, then writing each field. The patch replaces that with rlp.write(sha, fields) where fields is an rlp.RLPList. The resulting digest should be identical if the helper is correct. No functional or security change is evident from the diff.
Changed components
core/src/apps/ethereum/sign_auth_eip7702.pyInspect captured patch +2 / −11
### core/src/apps/ethereum/sign_auth_eip7702.py
@@ -92,18 +92,9 @@ async def sign_auth_eip7702(
)
done_msg = TR.ethereum__auth_done
- fields: tuple[rlp.RLPItem, ...] = (
- msg.chain_id,
- delegate_bytes,
- msg.nonce,
- )
-
sha = keccak256(_MAGIC)
-
- data_length = sum(rlp.length(field) for field in fields)
- rlp.write_header(sha, data_length, rlp.LIST_HEADER_BYTE)
- for field in fields:
- rlp.write(sha, field)
+ fields: rlp.RLPList = [msg.chain_id, delegate_bytes, msg.nonce]
+ rlp.write(sha, fields)
digest = sha.get_digest()
node = keychain.derive(msg.address_n)Why this scored 12/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.