Skip to content

Conversation

Sjors
Copy link
Member

@Sjors Sjors commented Mar 18, 2021

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.

@DrahtBot
Copy link
Contributor

DrahtBot commented Mar 18, 2021

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

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.

Copy link
Member

@fanquake fanquake left a comment

Choose a reason for hiding this comment

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

Concept ACK. While you're moving this around, could you also pull in a change similar to fanquake@42228d7. Note there are changes other than whitespace & formattting.

@Sjors Sjors force-pushed the 2021/03/signer_no_wallet branch from cafc7d2 to a1991f4 Compare March 22, 2021 14:51
@Sjors
Copy link
Member Author

Sjors commented Mar 22, 2021

@fanquake done

"walletdisplayaddress",
"Display address on an external signer for verification.\n",
return RPCHelpMan{"walletdisplayaddress",
"\nDisplay address on an external signer for verification.\n",
Copy link
Member

Choose a reason for hiding this comment

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

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.

if (!wallet) return NullUniValue;
CWallet* const pwallet = wallet.get();
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{
Copy link
Member

Choose a reason for hiding this comment

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

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?

@fanquake
Copy link
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.

@Sjors Sjors force-pushed the 2021/03/signer_no_wallet branch from a1991f4 to 1f6b367 Compare March 26, 2021 09:28
@Sjors
Copy link
Member Author

Sjors commented Mar 26, 2021

@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.

@Sjors
Copy link
Member Author

Sjors commented Apr 7, 2021

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

test_framework.authproxy.JSONRPCException: rpc/util.cpp:539 (HandleRequest)
Internal 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?

@Sjors Sjors force-pushed the 2021/03/signer_no_wallet branch from fdab2d0 to 80ed396 Compare April 8, 2021 08:15
Sjors added 3 commits April 8, 2021 17:56
This commit moves the ExternalSigner class and RPC methods out of the wallet module.

The enumeratesigners RPC can be used without a wallet since bitcoin#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.
An earlier version of bitcoin#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.
@Sjors Sjors force-pushed the 2021/03/signer_no_wallet branch from 80ed396 to 88d4d5f Compare April 8, 2021 15:56
@bitcoin bitcoin deleted a comment from xzavjierr Apr 9, 2021
Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

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

Code review ACK 88d4d5f

Copy link

@RonSherfey RonSherfey left a comment

Choose a reason for hiding this comment

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

requested changes

Copy link
Member

@fanquake fanquake left a comment

Choose a reason for hiding this comment

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

ACK 88d4d5f

@fanquake fanquake merged commit f0b4572 into bitcoin:master Apr 13, 2021
@Sjors Sjors deleted the 2021/03/signer_no_wallet branch April 13, 2021 11:16
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Apr 13, 2021
fanquake added a commit that referenced this pull request Apr 14, 2021
c8f469c external_signer: remove ExternalSignerException (fanquake)
9e0b199 external_signer: use const where appropriate (fanquake)
aaa4e5a wallet: remove CWallet::GetExternalSigner() (fanquake)
06a0673 external_signer: remove ignore_errors from Enumerate() (fanquake)
8fdbb89 refactor: unify external wallet runtime errors (fanquake)
f4652bf refactor: add missing includes to external signer code (fanquake)
54569cc refactor: move all signer code inside ENABLE_EXTERNAL_SIGNER #ifdefs (fanquake)

Pull request description:

  These are a few followups after #21467.

ACKs for top commit:
  Sjors:
    tACK c8f469c
  instagibbs:
    utACK c8f469c

Tree-SHA512: 3d5ac5df81680075e71e0e4a7595c520d746c3e37f016cf168c1e10da15541ebb1595aecaf2c08575636e9ff77d499644cae53180232b7049cfae0b923106e4e
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants