Skip to content

Commit

Permalink
Patch @ledgerhq/hw-app-eth for Arbitrum Sepolia chain id handling
Browse files Browse the repository at this point in the history
It currently seems like there is an issue with Ledger's handling of high
chain ids for certain transactions, where the Ledger can provide a first
byte that breaks the expectations of the chain id adjustment done for
legacy transactions to conform to EIP-155. The resulting `v` value
returned from the signing flow is invalid and Ethers throws because of
this.

This fix *may* be correct, but it may not be. To adjust for this fact,
the patch limits adjustments of the underlying parity value in ledger to
happen only when the chain id matches Arbitrum Sepolia's (412614).
  • Loading branch information
Shadowfiend committed Oct 31, 2023
1 parent b3548f4 commit 00b9877
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions patches/@ledgerhq+hw-app-eth+6.33.4.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/node_modules/@ledgerhq/hw-app-eth/lib/Eth.js b/node_modules/@ledgerhq/hw-app-eth/lib/Eth.js
index 4a7cb64..bd7051b 100644
--- a/node_modules/@ledgerhq/hw-app-eth/lib/Eth.js
+++ b/node_modules/@ledgerhq/hw-app-eth/lib/Eth.js
@@ -228,7 +228,7 @@ class Eth {
}
else {
// Legacy type transaction with a big chain ID
- v = chainId.times(2).plus(35).plus(ecc_parity).toString(16);
+ v = chainId.times(2).plus(35).plus(chainIdTruncated === 412614 ? ecc_parity % 2 : ecc_parity).toString(16);
}
}
else {

0 comments on commit 00b9877

Please sign in to comment.