From fd0f8936157f62b5e3fe31f718ddc7339a0e06f7 Mon Sep 17 00:00:00 2001 From: Coline Date: Mon, 25 Jul 2022 11:03:41 +0200 Subject: [PATCH] docs: some comment in code --- tests/speculos/ethereum_client/ethereum_cmd.py | 4 +--- tests/speculos/ethereum_client/ethereum_cmd_builder.py | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/speculos/ethereum_client/ethereum_cmd.py b/tests/speculos/ethereum_client/ethereum_cmd.py index d3b31ad..a13a817 100644 --- a/tests/speculos/ethereum_client/ethereum_cmd.py +++ b/tests/speculos/ethereum_client/ethereum_cmd.py @@ -200,15 +200,13 @@ class EthereumCommand: @contextmanager def personal_sign_tx(self, bip32_path: str, transaction: PersonalTransaction, result: List = list()) -> None: - """ - Does the same thing as simple_personal_sign but allows to create a batch of cmd apdu - """ try: for islast_apdu, apdu in self.builder.personal_sign_tx(bip32_path=bip32_path, transaction=transaction): if islast_apdu: with self.client.apdu_exchange_nowait(cla=apdu[0], ins=apdu[1], p1=apdu[2], p2=apdu[3], data=apdu[5:]) as exchange: + # the "yield" here allows to wait for a button interaction (click right, left, both) yield exchange response: bytes = exchange.receive() else: diff --git a/tests/speculos/ethereum_client/ethereum_cmd_builder.py b/tests/speculos/ethereum_client/ethereum_cmd_builder.py index f52e8c5..454e99e 100644 --- a/tests/speculos/ethereum_client/ethereum_cmd_builder.py +++ b/tests/speculos/ethereum_client/ethereum_cmd_builder.py @@ -266,6 +266,7 @@ class EthereumCommandBuilder: cdata = cdata + tx last_chunk = len(cdata) // MAX_APDU_LEN + # The generator allows to send apdu frames because we can't send an apdu > 255 for i, (chunk) in enumerate(chunked(MAX_APDU_LEN, cdata)): if i == 0 and i == last_chunk: yield True, self.serialize(cla=self.CLA,