Skip to content

Commit

Permalink
Removed old check on pre EIP-155 transactions
Browse files Browse the repository at this point in the history
- removed special sign APDU chunking from Python client
  • Loading branch information
apaillier-ledger committed Nov 25, 2024
1 parent 170387c commit 1576116
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 25 deletions.
14 changes: 2 additions & 12 deletions client/src/ledger_app_clients/ethereum/command_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,21 +267,11 @@ def sign(self, bip32_path: str, rlp_data: bytes, vrs: list) -> list[bytes]:
payload += rlp_data
p1 = P1Type.SIGN_FIRST_CHUNK
while len(payload) > 0:
chunk_size = 0xff

# TODO: Fix the app & remove this, issue #409
if len(vrs) == 3:
if len(payload) > chunk_size:
import rlp
diff = len(rlp.encode(vrs)) - (len(payload) - chunk_size)
if diff > 0:
chunk_size -= diff

apdus.append(self._serialize(InsType.SIGN,
p1,
0x00,
payload[:chunk_size]))
payload = payload[chunk_size:]
payload[:0xff]))
payload = payload[0xff:]
p1 = P1Type.SIGN_SUBSQT_CHUNK
return apdus

Expand Down
13 changes: 0 additions & 13 deletions src/ethUstream.c
Original file line number Diff line number Diff line change
Expand Up @@ -530,19 +530,6 @@ static parserStatus_e processTxInternal(txContext_t *context) {
PRINTF("parsing is done\n");
return USTREAM_FINISHED;
}
// Old style transaction (pre EIP-155). Transactions could just skip `v,r,s` so we needed to
// cut parsing here. commandLength == 0 could happen in two cases :
// 1. We are in an old style transaction : just return `USTREAM_FINISHED`.
// 2. We are at the end of an APDU in a multi-apdu process. This would make us return
// `USTREAM_FINISHED` preemptively. Case number 2 should NOT happen as it is up to
// `ledgerjs` to correctly decrease the size of the APDU (`commandLength`) so that this
// situation doesn't happen.
if ((context->txType == LEGACY && context->currentField == LEGACY_RLP_V) &&
(context->commandLength == 0)) {
context->content->vLength = 0;
PRINTF("finished\n");
return USTREAM_FINISHED;
}
if (context->commandLength == 0) {
PRINTF("Command length done\n");
return USTREAM_PROCESSING;
Expand Down

0 comments on commit 1576116

Please sign in to comment.