Skip to content

Conversation

@accumulator
Copy link
Member

@accumulator accumulator commented Aug 1, 2023

Refactor of wizard to new wizard framework (as in qml).

Notes:

  • For multisig Qt client shows master pubkey on cosigner keystore select page, not on separate page.
  • inserts extra separate pages for passphrase/ext entry in the base wizard flow, to mimic old wizard.
  • script and derivation path entry shown after HWW select but before device access/unlock

Todo:

  • hw wallets
    • trezor
      • device setup
      • test
    • jade
      • device setup
      • test
    • digital bitbox
      • device setup
      • test
    • bitbox02
      • test
    • coldcard
      • test
    • ledger
      • test
    • safe_t
      • device setup
      • test
    • keepkey
      • device setup
      • test

@accumulator accumulator force-pushed the qtwizard branch 2 times, most recently from 23febe5 to eda2d7b Compare August 1, 2023 13:11


class QEAbstractWizard(QDialog):
_logger = get_logger(__name__)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is nicer to inherit Logger, e.g. QEAbstractWizard(QDialog, Logger), and then

def __init__(self, config: 'SimpleConfig', app: QApplication, daemon):
    Logger.__init__(self)

Especially as QEAbstractWizard is not a singleton, it could be useful for debugging to have separate instances of it each their own logger. E.g. look at wallet.py/Abstract_Wallet: note it is overriding Logger.diagnostic_name. -- Though if you don't override diagnostic_name, the choice of having a per-class/per-instance logger becomes less important.

I guess this remark also applies to a lot of existing code in the qml GUI.
Anyway, it's more of a nit.

Copy link
Member Author

@accumulator accumulator Aug 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I guess this stems from my past experience with C++ and Java, where inheritance is more rigid. Pythonic multiple inheritance and mixins still feels a bit 'loose' to me, and although you could maintain the is a relationship, I'm used to loggers being a composition into a class. I guess the difference in interpretation is that a class using a logger should not imply the class being a full fledged logger within a logging framework.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, diagnostic_name might not be unique unless I use the id() of the wizard instance.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm used to loggers being a composition into a class

You are right that inheritance should not be overused.
Hmm, I guess it is mostly more consistent usage of the Logger across the codebase that I wanted, not necessarily inheritance.
We could change the Logger class to be used with composition instead. diagnostic_name and LOGGING_SHORTCUT could be passed as parameters to Logging.__init__,
and then do e.g. self.logger = Logger(name=self.diagnostic_name(), shortcut=LOGGING_SHORTCUT) in init.

diagnostic_name might not be unique unless I use the id() of the wizard instance

Yes, indeed. See lnpeer.Peer for an example where we explicitly use id() (through the transport) -- it was added during/after debugging an issue where multiple Peer objects did have the same colliding diagnostic names which was causing confusion.


Anyway, it's just a small remark; not too important re this PR.

@accumulator accumulator force-pushed the qtwizard branch 2 times, most recently from 17af9dd to c48fc00 Compare August 3, 2023 18:55
@accumulator accumulator force-pushed the qtwizard branch 4 times, most recently from 2ae343a to 538b91a Compare August 15, 2023 10:20
@spesmilo spesmilo deleted a comment from Erkansukgen Aug 15, 2023
@accumulator accumulator force-pushed the qtwizard branch 5 times, most recently from cb5758d to 9dc9a55 Compare August 23, 2023 09:43
@accumulator
Copy link
Member Author

@ecdsa, @SomberNight I've started adding HWW support for devices I can't test.
I've added test todos in the top post. Can you please check these devices for

  • proper handling when HWW uninitialized
  • can use to create standard wallet
  • can use for wallet encrypt by hardware

@accumulator
Copy link
Member Author

accumulator commented Aug 23, 2023

For my information, which HWW allow for initialization within Electrum? For trezor I'm sure (and is implemented), safe_t looks like it supports it?

@accumulator accumulator force-pushed the qtwizard branch 3 times, most recently from 320ef47 to cc841c9 Compare August 29, 2023 11:07
@accumulator
Copy link
Member Author

Removing draft status. Not all HWW that currently support initial device setup are ported, but it's ready to test.

@accumulator accumulator marked this pull request as ready for review August 29, 2023 13:27
@SomberNight SomberNight mentioned this pull request Aug 30, 2023
@ecdsa
Copy link
Member

ecdsa commented Aug 30, 2023

Can we rename qt_common to something else? I am a heavy user of tab-completions, and this new directory is slowing me down significantly; I now need to type "q + t + shift + slash" in order to have a non-ambiguous prefix, where "q + t" used to be sufficient. (before the introduction of the qml directory, the sole letter "q" was enough).

@accumulator
Copy link
Member Author

Can we rename qt_common to something else? I am a heavy user of tab-completions, and this new directory is slowing me down significantly; I now need to type "q + t + shift + slash" in order to have a non-ambiguous prefix, where "q + t" used to be sufficient. (before the introduction of the qml directory, the sole letter "q" was enough).

Done

@accumulator accumulator force-pushed the qtwizard branch 2 times, most recently from 7d006a2 to c30740a Compare August 31, 2023 12:23
accumulator and others added 16 commits September 20, 2023 14:34
qt: call is_finalized before closing the wizard dialog and add a check if wallet can be
    decrypted with the supplied secret (user pw, hw device)
…nd picked wallets,

add abstract method decl HW_PluginBase.wizard_entry_for_device
…-add rescan button in choose hw device,

clear clipboard before confirming seed.
also, consistent single quoting of strings
add auto-proceed to next page after init to trezor, safe_t, keepkey
- always store 'keystore_type' in cosigner data and use same types as main
- dont share 'hardware_device' in root of dict, but store for each cosigner
- properly return hardware keystore for hardware cosigners
Copy link
Member

@SomberNight SomberNight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some more comments. Also tested on safe-t, looks ok.

… standard wallets,

check hw wallet file decrypt in WCHWUnlock,
fix assumption 'wallet_type' exists in wallet open scenario.
@ecdsa
Copy link
Member

ecdsa commented Sep 22, 2023

not directly related, but the split_account function does not work on qml. For example, if I try ./run_electrum -w electrum/tests/test_storage_upgrade/client_2_5_4_trezor_multiacc -g qml -v, a popup is shown, but no split happens.

Since that is not needed on Android, I think this should be removed from qml

SomberNight added a commit that referenced this pull request Sep 22, 2023
Toporin added a commit to Toporin/electrum-satochip that referenced this pull request Mar 20, 2024
Include new wizard Qt desktop client spesmilo#8560
WIP
TODO: build binaries, adapt qrcodewidget
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic-wizard 🧙‍♂️ related to wallet creation/restore wizard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants