Add clear-signing guard + direct Uniswap V3 swap path - #33
Closed
szhygulin wants to merge 1 commit into
Closed
Conversation
Classify every prepared tx as clear-signable / blind-sign / blind-sign-unavoidable and surface a verification path to the user. A domain-tagged payload fingerprint ties the decoder result (swiss-knife.xyz) to the exact bytes the Ledger will sign; blind-sign-unavoidable cases recommend rejection when the user cannot independently verify the call. To maximize clear-sign coverage, add a direct Uniswap V3 swap builder (exactInputSingle + multi-hop via WETH, with native wrap/unwrap through multicall) and route prepare_swap to it when its minOut is within 1.0% (L1) or 0.5% (L2s) of LiFi's quote. TRON transactions are unconditionally classified clear-signable since they go through the TRON Ledger app with local protobuf verification.
Collaborator
Author
|
Closing without merge — the underlying clear-signing vs blind-signing classification turned out to be inaccurate (several commands labeled clear-signable are actually blind-signed on Ledger, and vice versa). Needs a redo from verified sources. |
4 tasks
This was referenced Apr 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
trustMode—clear-signable(Ledger decodes on-device),blind-sign(swiss-knife.xyz decoder URL supplied), orblind-sign-unavoidable(unknown contract / cross-chain bridge — recommend rejection). A domain-taggedpayloadHashfingerprint lets the user cross-reference decoder output against the bytes the Ledger will actually sign, echoed at both prepare-time and send-time.buildUniswapV3DirectSwapprobes single-hopexactInputSingleand falls back to multi-hopexactInputvia WETH, handling native ETH in/out throughmulticallwrap/unwrap. Selectors are in the Ledger clear-sign set, so routes via this path get hardware-verified on-device instead of blind-signed.prepare_swapruns LiFi and direct-V3 quotes in parallel and prefers direct when itsminOutis within 1.0% (L1) or 0.5% (L2s) of LiFi's. Otherwise it falls back to LiFi and surfaces the gap viarejectedAlternative. Cross-chain always goes via LiFi and is stampedblind-sign-unavoidable.Test plan
npx vitest run— 380 / 380 passing, including 3 new suites (clear-sign-guard.test.ts,uniswap-v3-direct.test.ts,swap-routing-policy.test.ts)npx tsc --noEmit— cleantrustMode === "clear-signable"and theroutingDecisionisdirect-v3blind-sign-unavoidablewith adecoderUrlv0.5.0to ship via the release workflow