Skip to content

Commit 1576116

Browse files
Removed old check on pre EIP-155 transactions
- removed special sign APDU chunking from Python client
1 parent 170387c commit 1576116

File tree

2 files changed

+2
-25
lines changed

2 files changed

+2
-25
lines changed

client/src/ledger_app_clients/ethereum/command_builder.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -267,21 +267,11 @@ def sign(self, bip32_path: str, rlp_data: bytes, vrs: list) -> list[bytes]:
267267
payload += rlp_data
268268
p1 = P1Type.SIGN_FIRST_CHUNK
269269
while len(payload) > 0:
270-
chunk_size = 0xff
271-
272-
# TODO: Fix the app & remove this, issue #409
273-
if len(vrs) == 3:
274-
if len(payload) > chunk_size:
275-
import rlp
276-
diff = len(rlp.encode(vrs)) - (len(payload) - chunk_size)
277-
if diff > 0:
278-
chunk_size -= diff
279-
280270
apdus.append(self._serialize(InsType.SIGN,
281271
p1,
282272
0x00,
283-
payload[:chunk_size]))
284-
payload = payload[chunk_size:]
273+
payload[:0xff]))
274+
payload = payload[0xff:]
285275
p1 = P1Type.SIGN_SUBSQT_CHUNK
286276
return apdus
287277

src/ethUstream.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -530,19 +530,6 @@ static parserStatus_e processTxInternal(txContext_t *context) {
530530
PRINTF("parsing is done\n");
531531
return USTREAM_FINISHED;
532532
}
533-
// Old style transaction (pre EIP-155). Transactions could just skip `v,r,s` so we needed to
534-
// cut parsing here. commandLength == 0 could happen in two cases :
535-
// 1. We are in an old style transaction : just return `USTREAM_FINISHED`.
536-
// 2. We are at the end of an APDU in a multi-apdu process. This would make us return
537-
// `USTREAM_FINISHED` preemptively. Case number 2 should NOT happen as it is up to
538-
// `ledgerjs` to correctly decrease the size of the APDU (`commandLength`) so that this
539-
// situation doesn't happen.
540-
if ((context->txType == LEGACY && context->currentField == LEGACY_RLP_V) &&
541-
(context->commandLength == 0)) {
542-
context->content->vLength = 0;
543-
PRINTF("finished\n");
544-
return USTREAM_FINISHED;
545-
}
546533
if (context->commandLength == 0) {
547534
PRINTF("Command length done\n");
548535
return USTREAM_PROCESSING;

0 commit comments

Comments
 (0)