Skip to content

Stop shipping a Trezor path that cannot work - #280

Merged
Fuma419 merged 1 commit into
mainfrom
agent/drop-dead-trezor-surface
Sep 4, 2026
Merged

Stop shipping a Trezor path that cannot work#280
Fuma419 merged 1 commit into
mainfrom
agent/drop-dead-trezor-surface

Conversation

@Fuma419

@Fuma419 Fuma419 commented Sep 4, 2026

Copy link
Copy Markdown
Owner

First of two PRs for approved pitch #7. The owner's decision on the pitch's open question was do not support Trezor yet, so this removes the dead surface rather than wiring it up. PR 2 then turns ESLint into a CI gate, which is only possible once these errors are gone.

Trezor has never worked in this fork

TrezorConnect was called in two places:

  • src/api/extension/index.js:1345initHW
  • src/api/extension/signing.js:579signTxHW

There is no Trezor package in package.json or node_modules, no webpack externals, and no <script> tag. Choosing Trezor raised ReferenceError: TrezorConnect is not defined.

Three things kept that invisible:

  1. src/api/globals.d.ts declared TrezorConnect and four Cardano* enums as ambient any, so npm run typecheck passed over bindings that do not exist at runtime.
  2. ESLint reported all 15 as no-undef errors — but there is no lint stage in Jenkinsfile or ci.yml.
  3. .eslintignore excludes src/api/extension/index.js outright.

The surrounding code was equally dead: trezorWidget.jsx opened an iframe onto Trezor/popup.html, which is not in the repo, and trezorContentScript.js connected a trezor-connect port that no background listener answers. The hardware picker in hw.jsx has only ever offered Keystone and Ledger, so no user can create a Trezor account in this build.

Removed

Area What went
Runtime txToTrezor + outputsToTrezor (util.js, 427 lines, called only from the Trezor branch); the signTxHW Trezor branch; the initHW Trezor branch
Types all five fake ambient globals in globals.d.ts
Bundles trezorTx and trezorContentScript webpack entries, the trezorTx.html page
Files tabs/trezorTx.jsx, components/trezorWidget.jsx, pages/Content/trezorContentScript.js, pages/Tab/trezorTx.html
Manifest the Trezor content script, and frame-src https://connect.trezor.io/ — which narrows the extension CSP
Dead refs TAB.trezorTx, the unused trezorRef/<TrezorWidget> in hw.jsx, now-unused TAB/createTab imports in four files

Net: 847 deletions, 160 insertions.

Kept, deliberately

An account already stored as trezor-* must not be stranded — if it stopped being recognised as hardware it would have no password path either. So HW.trezor, the isHardwareAccountIndex prefix check in vault.js, HW_LOGO_DEVICES, and the Trezor logo all stay. Such an account still loads and still shows its own device name.

What changes for it is the failure: every entry point (signTxHW, initHW, the hardware confirm dialog, and the send / staking / governance / transaction-builder paths) now throws one shared TREZOR_UNSUPPORTED message naming Keystone, Ledger and software accounts, instead of a ReferenceError. confirmModal also stops labelling anything that is not a Ledger as a "Trezor".

Verification

  • New trezor-unsupported.test.js (6 tests): the message names alternatives; trezor-* is still a hardware account and keeps its logo; all seven entry points refuse with the message; no TrezorConnect or Cardano* enum remains; and no Trezor bundle, page, or iframe permission ships.
  • Removed two mobile-layout layout contracts and the stake-unified-wallet assertions that guarded files which no longer exist.
  • e2e/send-csp.spec.js CSP mirror updated to match the manifest.
  • Suite 906 passed, npm run typecheck clean, and ESLint errors in hand-written code go 15 → 0 (the 63 remaining are all in generated src/wasm/, which PR 2 ignores).
  • Docs corrected where they claimed Trezor signing works: README.md, AGENTS.md, docs/TX_ARCHITECTURE_PLAN.md, MOBILE.md, and the CSL-bridge rule.

Trezor signing has been broken end to end in this fork. `TrezorConnect`
was called in `initHW` and `signTxHW`, but there is no Trezor package in
package.json or node_modules, no webpack external and no script tag, so
choosing Trezor raised `ReferenceError: TrezorConnect is not defined`.
`globals.d.ts` declared it and four Cardano* enums as ambient `any`, which
hid the missing bindings from `npm run typecheck` as well as from readers.
ESLint reported all fifteen as no-undef errors, but this repo has no lint
gate and `.eslintignore` excludes `extension/index.js` anyway.

Trezor is not a supported device yet, so remove the surface rather than
wire it up: the trezorTx tab and its HTML page, the Trezor widget whose
iframe pointed at a popup file that is not in the repo, the content script
whose port had no listener in the background worker, the two webpack
entries, and `txToTrezor`/`outputsToTrezor` in util.js (427 lines that
only that path called). The manifest drops the Trezor content script and
the `frame-src https://connect.trezor.io/` allowance with it, which
narrows the extension CSP.

An account already stored as `trezor-*` must not be stranded, so keep
`HW.trezor`, the vault prefix check that makes it a hardware account, and
its logo. Every signing entry point now refuses it with one shared
message naming Keystone, Ledger and software accounts, instead of a
ReferenceError. The hardware dialog also stops calling anything that is
not a Ledger a Trezor.
@vercel

vercel Bot commented Sep 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
lucem-wallet Ignored Ignored Preview Sep 4, 2026 5:11pm UTC

Request Review

@Fuma419
Fuma419 enabled auto-merge (squash) September 4, 2026 17:11
@Fuma419
Fuma419 merged commit aa4acf5 into main Sep 4, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant