Decouple WalletModel from RPCExecutor #841

pull furszy wants to merge 1 commits into bitcoin-core:master from furszy:2024_gui_rpconsole_walletmodel_dependency changing 2 files +14 −16
  1. furszy commented at 1:57 pm on October 4, 2024: member

    A more comprehensive fix for the issue described in #837.

    Since the WalletModel class is unavailable when compiling without wallet support (-DENABLE_WALLET=0), the RPC executor class should not be coupled to it. This decoupling ensures GUI compatibility with builds that omit wallet support.

    This also drops an extra #ifdef ENABLE_WALLET block which is always good.

  2. DrahtBot commented at 1:57 pm on October 4, 2024: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK pablomartin4btc

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #692 (Debug Console implementation of generate method by hernanmarino)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  3. promag commented at 2:13 pm on October 4, 2024: contributor
    Concept meh, WalletModel is coupled to RPCConsole, why bother with RPCExecutor?
  4. hebasto renamed this:
    gui: bugfix, decouple WalletModel from RPCExecutor
    bugfix: Decouple WalletModel from RPCExecutor
    on Oct 4, 2024
  5. furszy commented at 2:49 pm on October 4, 2024: member

    Concept meh, WalletModel is coupled to RPCConsole, why bother with RPCExecutor?

    Thats because the GUI view code and the RPC command parsing and executing functions are entangled right now, but this doesn’t need to remain the case. While the view might require access to the WalletModel for retrieving certain information to display (perhaps more so in the future because we don’t do much with it now), the underlying procedures for running the commands don’t depend on it. They only need the wallet name, if it exists, to append the URI to the command and they could be placed on a different file.

  6. DrahtBot added the label CI failed on Oct 4, 2024
  7. DrahtBot commented at 3:26 pm on October 4, 2024: contributor

    🚧 At least one of the CI tasks failed. Debug: https://github.com/bitcoin-core/gui/runs/31084944010

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

  8. hebasto commented at 3:32 pm on October 4, 2024: member

    @furszy 3f34c04628f1cb0f59afb5176dae3a0e8d414d7d “gui: bugfix, decouple WalletModel from RPCExecutor”

    Maybe remove “bugfix” from the commit message, as there is no reproducible bug in the master branch?

  9. furszy force-pushed on Oct 4, 2024
  10. hebasto renamed this:
    bugfix: Decouple WalletModel from RPCExecutor
    Decouple WalletModel from RPCExecutor
    on Oct 4, 2024
  11. gui: decouple WalletModel from RPCExecutor
    Since the `WalletModel` class is unavailable when compiling
    without wallet support `(-DENABLE_WALLET=0)`, the RPC executor
    class should not be coupled to it. This decoupling ensures GUI
    compatibility with builds that omit wallet support.
    002b792b9a
  12. furszy force-pushed on Oct 4, 2024
  13. DrahtBot removed the label CI failed on Oct 4, 2024
  14. in src/qt/rpcconsole.cpp:169 in 002b792b9a
    168@@ -169,7 +169,7 @@ class PeerIdViewDelegate : public QStyledItemDelegate
    169  * @param[out]   pstrFilteredOut  Command line, filtered to remove any sensitive data
    


    pablomartin4btc commented at 12:54 pm on October 7, 2024:

    nit: describe wallet_name as a param[in] (wallet_model wasn’t there either)

    0 * [@param](/bitcoin-core-gui/contributor/param/)[out]   pstrFilteredOut  Command line, filtered to remove any sensitive data
    1 * [@param](/bitcoin-core-gui/contributor/param/)[in]   wallet_mame ...
    
  15. pablomartin4btc commented at 1:14 pm on October 7, 2024: contributor

    tACK 002b792b9a85100d89e47706c29cf1fd355d9727

    Tested the rpc console with and without -DENABLE_WALLET. I think the refactor makes sense as the rpc just needs the wallet name for the related commands.

    Out of the scope of this PR, I noticed that the order of the wallets in the combo-boxes corresponds to the settings.json file and if the user changes the wallet in the main window, when the rpc console is open, the wallet in the console combo doesn’t correspond with the one in the main window, which is ok if you want to compare data but I think when the console opens it should have the same. Also perhaps we should show the last used wallet (in ./config/Bitcoin-Qt-*.conf?) when qt starts (if still in the loaded wallets in settings.json) instead of showing the first of the list.

  16. furszy commented at 8:15 pm on October 7, 2024: member

    Out of the scope of this PR, I noticed that the order of the wallets in the combo-boxes corresponds to the settings.json file and if the user changes the wallet in the main window, when the rpc console is open, the wallet in the console combo doesn’t correspond with the one in the main window, which is ok if you want to compare data but I think when the console opens it should have the same. Also perhaps we should show the last used wallet (in ./config/Bitcoin-Qt-*.conf?) when qt starts (if still in the loaded wallets in settings.json) instead of showing the first of the list.

    This surely comes from the fact that the RPC console view is created during initialization. The presentation of the dialog in screen is merely a show() call. So there is no “open for the first time” concept right now. If the goal is still to move to a new GUI, I wouldn’t start changing the views behavior now. The current behavior doesn’t seem to be “that” bad anyway.

  17. pablomartin4btc commented at 8:24 pm on October 7, 2024: contributor

    If the goal is still to move to a new GUI, I wouldn’t start changing the views behavior now.

    Yeah, neither do I, just mentioning it here since I just passed thru while testing.


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/gui. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-10-22 22:20 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me