fix: swapper paranoia ledger signing fix #8577
Merged
+15
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Follows up on #8570 (the accidental, actual fix for #8574) with another paranoia fix for consistency, which, if we used in the first place, would also be an actual fix.
The reason why Ledger signing was borked was because of
useTradeNetworkFeesCryptoBaseUnit
callingadapter.getAddress()
without apubKey
property, meaning we use on-device derivation to get the address.This would normally be fine when we're able to get an address from the Ledger, we definitely should prefer that vs. using a pubKey we got somewhere from the app state, unfortunately, that's not always possible.
Unfortunately, in this precise case, it was not: making a device call to get the address while Tx signing is in-flight will result in an error being thrown, which will throw (pun intended) swapper into an errored state itself.
That shouldn't be an issue anymore after #8570, but, just for the sake of consistency and paranoia, this PR ensures we don't do on-device derivation here and pass the pubKey in instead, resulting in either it being used directly for address-based accounts, or using unchained to derive addy from xpub using unchained for UTXOs.
Issue (if applicable)
Risk
Low
Testing
Engineering
Operations
Screenshots (if applicable)
https://jam.dev/c/11f7e8a6-685d-4357-b15b-bafa82becbb9