polkadot-js / extension

Simple browser extension for managing Polkadot and Substrate network accounts in a browser. Allows the signing of extrinsics using these accounts. Also provides a simple interface for compliant extensions for dapps.
Apache License 2.0
972 stars 417 forks source link

Increase QR code display speed for multipart QR signature data for external signer accounts #1276

Open renesy opened 1 year ago

renesy commented 1 year ago

I'm submitting a ...

When using an external QR-code signer account (like Polkadot Vault smartphone app) this extension displays the to-be-signed transaction data as QR codes. Larger data is split across multiple QR codes which are changed automatically by the extension. This feature request suggests to increase the frequency at which those QR codes are changed, because the current frequency is too low for very large data (like 900 kB for registrar.register).

Large transaction data (~1 MB) can be transferred to an external QR signer account in a short amount of time.

  1. Very long QR code scanning sessions (>30min) are bad user experience
  2. Very long signing sessions lead to timeouts for some applications (like Multix)
  3. At the moment it's not possible to call registrar.register with 900 kB wasm code and Multix + polkadot{.js} extension + Polkadot Vault due to slow QR code display and application timeout
  4. The Polkadot Vault smartphone app is already capable of scanning QR codes at high frequency. Tested with: https://metadata.parity.io/?tab=1#/polkadot

Therefore, my suggestion is:

  1. Increase the QR code change frequency of the extension to the same level as: https://metadata.parity.io/?tab=1#/polkadot
  2. Or, make the frequency user configurable if faster and slower QR code scanners need to be accommodated at the same time.
jacogr commented 1 year ago

The metadata scanning uses Raptor, which is not the "normal" QR display, rather an adaptation of fountain codes, which is a fascinating theory and certainly solves real-world issues. This means that and adaptation of that not only requires a change on the extension, but also in all apps that read QR codes.

With the current implementation rate is difficult to optimize - older phones always have issues with faster rates. (We had numerous issues in the past with increasing the rate with the "normal-as-used-QR" display)

As of now, this is sadly a "won't fix" (or rather a "won't touch", at some point if there are libraries available to generate these on the fly in the browser, i.e. a pure JS implementation and the apps consuming these have support for it, can revisit)

renesy commented 1 year ago

Thanks for the explanation @jacogr

Could you elaborate on the second idea: Making the rate user configurable. Or even adaptive based on data size?