-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Wallet should not override signing errors #19568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
ACK cf9245b97a8793510eb03944c35309b6cf4f4c2d |
|
This makes sense, we don't want earlier error messages to get lost and replaced with less specific errors. It is slightly worrying that this does not affect the tests, though. It doesn't necessarily have to be in this PR, but can we test signing failure somehow? |
Yepp, I am considering changing that in a follow-up. If I am too busy I will open an issue instead. |
promag
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review ACK cf9245b97a8793510eb03944c35309b6cf4f4c2d.
Agree that a test would be nice for this change.
src/wallet/wallet.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this block is unnecessary? The error Input not found or already spent is already set in ::SignTransaction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And not sure why not set Unable to sign input, missing keys in ::SignTransaction.
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
|
Please see #19578 before merging this. |
I had noticed that as well and was looking for feedback from reviewers in my description if I should do this instead. See:
|
|
|
I take that as the error block can be removed. It seems the SPK |
Assuming you mean the change in |
|
ACK e7448d6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e7448d6 wallet: Don't override signing errors (Fabian Jahr) Pull request description: While reviewing bitcoin#17204 I noticed that the errors in `input_errors` from `::SignTransaction` where being overridden by `CWallet::SignTransaction`. For example, a Script related error led to incomplete signature data which led to `CWallet::SignTransaction` reporting that keys were missing, which was a less precise error than the original one. Additionally, the error `"Input not found or already spent"` is [duplicated in `sign.cpp`](https://github.com/bitcoin/bitcoin/blob/c7b4968552c704f1e2e9a046911e1207f5af5fe0/src/script/sign.cpp#L481), so the error here is redundant at the moment. So technically the whole error block could be removed, I think. However, this code is affected by the ongoing work on the wallet so there might be a reason why these errors are here. But even if there is a reason to keep them, I don't think existing, potentially more precise errors should be overridden here unless we want to hide them from the users. I am looking for feedback if this is a work in progress state where these errors could be more useful in the future or if they can be removed. On testing: even though [the errors in `CWallet` are covered](https://marcofalke.github.io/btc_cov/total.coverage/src/wallet/wallet.cpp.gcov.html), all tests still pass after removing them. I am not sure if there is a desire to cover these specific error messages, tests in `test/functional/rpc_signrawtransaction.py` seem to aim for a more generic approach. ACKs for top commit: achow101: ACK e7448d6 meshcollider: Code review ACK e7448d6 Tree-SHA512: 3e2bc11d05379d2aef87b093a383d1b044787efc70e35955b2f8ecd028b6acef02f386180566af6a1a63193635f5d685466e2f6141c96326c49ffc5c81ca3e23
Summary: > While reviewing #17204 I noticed that the errors in input_errors from ::SignTransaction where being overridden by CWallet::SignTransaction. For example, a Script related error led to incomplete signature data which led to CWallet::SignTransaction reporting that keys were missing, which was a less precise error than the original one. Note: in our codebase the errors are overwritten one more time, as a result of a change in D8100. The comment mentions "get proper error messages". None of these error messages seem to be tested at the moment, because removing this block does not cause any test to fail. This is a backport of [[bitcoin/bitcoin#19568 | core#19568]] Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, majcosta Reviewed By: #bitcoin_abc, majcosta Differential Revision: https://reviews.bitcoinabc.org/D10085
While reviewing #17204 I noticed that the errors in
input_errorsfrom::SignTransactionwhere being overridden byCWallet::SignTransaction. For example, a Script related error led to incomplete signature data which led toCWallet::SignTransactionreporting that keys were missing, which was a less precise error than the original one.Additionally, the error
"Input not found or already spent"is duplicated insign.cpp, so the error here is redundant at the moment. So technically the whole error block could be removed, I think. However, this code is affected by the ongoing work on the wallet so there might be a reason why these errors are here. But even if there is a reason to keep them, I don't think existing, potentially more precise errors should be overridden here unless we want to hide them from the users. I am looking for feedback if this is a work in progress state where these errors could be more useful in the future or if they can be removed.On testing: even though the errors in
CWalletare covered, all tests still pass after removing them. I am not sure if there is a desire to cover these specific error messages, tests intest/functional/rpc_signrawtransaction.pyseem to aim for a more generic approach.