Move external signer out of wallet module #21467

pull Sjors wants to merge 3 commits into bitcoin:master from Sjors:2021/03/signer_no_wallet changing 27 files +179 −150
  1. Sjors commented at 2:23 pm on March 18, 2021: member

    In addition, this PR enables external signer testing on CI.

    This PR moves the ExternalSigner class and RPC methods out of the wallet module.

    The enumeratesigners RPC can be used without a wallet since #21417. With additional modifications external signers could be used without a wallet in general, e.g. via signrawtransaction.

    The signerdisplayaddress RPC is ranamed to walletdisplayaddress because it requires wallet context. A future displayaddress RPC call without wallet context could take a descriptor argument.

    This commit fixes a rpc_help.py failure when configured with --disable-wallet.

  2. DrahtBot added the label Build system on Mar 18, 2021
  3. DrahtBot added the label Docs on Mar 18, 2021
  4. DrahtBot added the label RPC/REST/ZMQ on Mar 18, 2021
  5. DrahtBot added the label Wallet on Mar 18, 2021
  6. Sjors force-pushed on Mar 18, 2021
  7. DrahtBot commented at 11:05 pm on March 18, 2021: member

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

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #21538 (fuzz: Add fuzzing syscall sandbox: detect use of unexpected syscalls when fuzzing (“syscall sanitizer”) by practicalswift)
    • #21378 (Convert taproot to flag day activation by ajtowns)
    • #21207 (MOVEONLY: CWallet transaction code out of wallet.cpp/.h by ryanofsky)
    • #21206 (refactor: Make CWalletTx sync state type-safe by ryanofsky)
    • #20744 ([POC] Use std::filesystem. Remove Boost Filesystem & System by fanquake)
    • #20586 (Fix Windows build with –enable-werror by hebasto)
    • #20487 (Add syscall sandboxing using seccomp-bpf (Linux secure computing mode) by practicalswift)
    • #19602 (wallet: Migrate legacy wallets to descriptor wallets by achow101)
    • #19438 (Introduce deploymentstatus by ajtowns)

    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.

  8. Sjors force-pushed on Mar 19, 2021
  9. fanquake requested review from achow101 on Mar 19, 2021
  10. fanquake requested review from instagibbs on Mar 19, 2021
  11. in src/rpc/external_signer.cpp:7 in cafc7d210d outdated
    2@@ -3,13 +3,12 @@
    3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
    4 
    5 #include <chainparamsbase.h>
    6+#include <external_signer.h>
    7 #include <key_io.h>
    


    fanquake commented at 7:49 am on March 22, 2021:
    I don’t think you need key_io.h anymore?
  12. fanquake commented at 7:52 am on March 22, 2021: member
    Concept ACK. While you’re moving this around, could you also pull in a change similar to https://github.com/fanquake/bitcoin/commit/42228d716a263cb787cbe8125c855518127e9449. Note there are changes other than whitespace & formattting.
  13. Sjors force-pushed on Mar 22, 2021
  14. Sjors commented at 2:51 pm on March 22, 2021: member
    @fanquake done
  15. in src/wallet/rpcwallet.cpp:4531 in a1991f44fa outdated
    4526@@ -4527,36 +4527,36 @@ static RPCHelpMan upgradewallet()
    4527 #ifdef ENABLE_EXTERNAL_SIGNER
    4528 static RPCHelpMan walletdisplayaddress()
    4529 {
    4530-    return RPCHelpMan{
    4531-        "walletdisplayaddress",
    4532-        "Display address on an external signer for verification.\n",
    4533+    return RPCHelpMan{"walletdisplayaddress",
    4534+        "\nDisplay address on an external signer for verification.\n",
    


    MarcoFalke commented at 6:45 pm on March 22, 2021:
    nit: I think the leading and trailing newlines should be the responsibility of RPCHelpMan. Also, they wouldn’t make sense if the help is exported as json.
  16. in src/wallet/rpcwallet.cpp:4538 in a1991f44fa outdated
    4540-        [](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue {
    4541-            std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
    4542-            if (!wallet) return NullUniValue;
    4543-            CWallet* const pwallet = wallet.get();
    4544+    [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
    4545+{
    


    MarcoFalke commented at 6:46 pm on March 22, 2021:
    nit: For new code it would be good to use properly clang-formatted code. Any reason to make a change to move away from clang-formatted code?
  17. fanquake commented at 5:26 am on March 23, 2021: member
    @Sjors I discussed with @MarcoFalke, and given there isn’t currently a correct RPCHelpMan formatting style, can you drop the formatting/whitespace changes? We’ll just add the [&]s, the examples etc. Sorry for the bum steer.
  18. Sjors force-pushed on Mar 26, 2021
  19. Sjors commented at 9:28 am on March 26, 2021: member

    @fanquake done (I think) @MarcoFalke wrote:

    I think the leading and trailing newlines should be the responsibility of RPCHelpMan. Also, they wouldn’t make sense if the help is exported as json.

    I left out the newline characters.

  20. Sjors force-pushed on Apr 1, 2021
  21. Sjors force-pushed on Apr 2, 2021
  22. fanquake added this to the "PRs" column in a project

  23. DrahtBot added the label Needs rebase on Apr 7, 2021
  24. Sjors force-pushed on Apr 7, 2021
  25. Sjors commented at 6:57 pm on April 7, 2021: member

    After rebase the command walletdisplayaddress(address1) in test/function/wallet_signer.py line 99 fails with

    0test_framework.authproxy.JSONRPCException: rpc/util.cpp:539 (HandleRequest)
    1Internal bug detected: 'std::any_of(m_results.m_results.begin(), m_results.m_results.end(), [ret](const RPCResult& res) { return res.MatchesType(ret); })'
    

    Not sure what I’m doing wrong here… @MarcoFalke?

  26. DrahtBot removed the label Needs rebase on Apr 7, 2021
  27. in src/wallet/rpcwallet.cpp:4537 in fdab2d042f outdated
    4532+    return RPCHelpMan{"walletdisplayaddress",
    4533+        "Display address on an external signer for verification.",
    4534+        {
    4535+            {"address",     RPCArg::Type::STR, RPCArg::Optional::NO, /* default_val */ "", "bitcoin address to display"},
    4536+        },
    4537+        RPCResult{RPCResult::Type::NONE,"",""},
    


    MarcoFalke commented at 7:08 am on April 8, 2021:
    This is wrong. It is an obj
  28. DrahtBot added the label Needs rebase on Apr 8, 2021
  29. Sjors force-pushed on Apr 8, 2021
  30. DrahtBot removed the label Needs rebase on Apr 8, 2021
  31. Move external signer out of wallet module
    This commit moves the ExternalSigner class and RPC methods out of the wallet module.
    
    The enumeratesigners RPC can be used without a wallet since #21417.
    With additional modifications external signers could be used without a wallet in general, e.g. via signrawtransaction.
    
    The signerdisplayaddress RPC is ranamed to walletdisplayaddress because it requires wallet context.
    A future displayaddress RPC call without wallet context could take a descriptor argument.
    
    This commit fixes a rpc_help.py failure when configured with --disable-wallet.
    b54b2e7b1a
  32. ci: use --enable-external-signer instead of --with-boost-process
    An earlier version of #16546 used both --with-boost-process and --enable-external-signer, which was simplified to only use the latter. However I forgot to update CI, so the external signer tests were not run.
    b0db187e5b
  33. rpc: add help for enumeratesigners and walletdisplayaddress 88d4d5ff2f
  34. Sjors force-pushed on Apr 8, 2021
  35. fanquake deleted a comment on Apr 9, 2021
  36. ryanofsky approved
  37. ryanofsky commented at 6:18 pm on April 9, 2021: member
    Code review ACK 88d4d5ff2f5c71a9a2f4c78c2b2e2fd00568cfee
  38. RonSherfey changes_requested
  39. RonSherfey commented at 3:17 pm on April 11, 2021: none
    requested changes
  40. fanquake approved
  41. fanquake commented at 6:34 am on April 13, 2021: member
    ACK 88d4d5ff2f5c71a9a2f4c78c2b2e2fd00568cfee
  42. fanquake merged this on Apr 13, 2021
  43. fanquake closed this on Apr 13, 2021

  44. Sjors deleted the branch on Apr 13, 2021
  45. sidhujag referenced this in commit ad75fd3f1b on Apr 13, 2021
  46. fanquake moved this from the "PRs" to the "Done" column in a project

  47. fanquake referenced this in commit e7af2f35af on Apr 14, 2021
  48. DrahtBot locked this on Aug 18, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-07-03 10:13 UTC

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