-
Notifications
You must be signed in to change notification settings - Fork 37.7k
[tests] New fuzz target wallet_rpc #30570
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
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/30570. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsNo conflicts as of last run. |
664dd71
to
f94ae1c
Compare
src/test/fuzz/rpc.cpp
Outdated
"loadwallet", | ||
}; | ||
// RPC commands which are safe for fuzzing. | ||
const std::vector<std::string> WALLET_RPC_COMMANDS_SAFE_FOR_FUZZING{ |
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.
I will need to move some of these over due to the rpc accessing the disk or network activity
f94ae1c
to
0bf4c56
Compare
🚧 At least one of the CI tasks failed. HintsMake sure to run all tests locally, according to the documentation. The failure may happen due to a number of reasons, for example:
Leave a comment here, if you need help tracking down a confusing failure. |
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.
Concept ACK. To fix the CI failure, you'll have to move the new file to src/wallet/test/fuzz/
.
Concept ACK |
1 similar comment
Concept ACK |
0bf4c56
to
c994331
Compare
c994331
to
352b68c
Compare
985b8e6
to
2c8cb2b
Compare
🚧 At least one of the CI tasks failed. HintsMake sure to run all tests locally, according to the documentation. The failure may happen due to a number of reasons, for example:
Leave a comment here, if you need help tracking down a confusing failure. |
6ce9352
to
909aafe
Compare
What is the state of this? |
I have been busy for the last couple of weeks I can take a look at it and finish up to make it ready for review in the next week or so, sorry for the delay |
909aafe
to
2b541b0
Compare
By reusing some of the logic for the rpc fuzz target this new fuzz target wallet_rpc adds coverage to the wallet rpc calls.
2b541b0
to
26591de
Compare
@brunoerg I think this should be ready for review now, I think I just need to currate the list of |
}; | ||
|
||
RPCWalletFuzzTestingSetup* rpc_wallet_testing_setup = nullptr; | ||
std::string g_limit_to_rpc_command_wallet; |
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.
In 26591de: g_limit_to_rpc_command_wallet
is not being set, so LIMIT_TO_RPC_COMMAND
has no effect in this target. When using LIMIT_TO_RPC_COMMAND
for this target, it's probably setting g_limit_to_rpc_command
in fuzz/rpc.cpp
.
Did you advance on curating the list? Is this the final list? |
std::terminate(); | ||
} | ||
if (safe_for_fuzzing && not_safe_for_fuzzing) { | ||
std::cerr << "Error: RPC command \"" << rpc_command << "\" found in *both* RPC_COMMANDS_SAFE_FOR_FUZZING and RPC_COMMANDS_NOT_SAFE_FOR_FUZZING. Please update " << __FILE__ << ".\n"; | ||
std::cerr << "Error: RPC command \"" << rpc_command << "\" found in *both* rpc_commands_safe_for_fuzzing and RPC_COMMANDS_NOT_SAFE_FOR_FUZZING. Please update " << __FILE__ << ".\n"; |
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.
In 26591de: nit: If something got wrong with wallet/test/fuzz/rpc.cpp
, this will ask to update the test/fuzz/rpc.cpp
file.
const std::vector<std::string> WALLET_RPC_COMMANDS_NOT_SAFE_FOR_FUZZING{ | ||
"importwallet", | ||
"loadwallet", | ||
}; |
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.
There are many more wallet rpcs that go to disk (e.g. createwallet
). I would assume a lot of the rpcs that modify a wallet also flush the changes to disk. And I don't think it is possible to even have a wallet that doesn't exist on disk, so trying to avoid disk access can't work.
To work around this I would suggest to create (and delete at the end) a new wallet (e.g. /tmp/fuzz-wallet-xyz
) each iteration and call wallet rpcs on that specific wallet (could be more than one).
I think we will have here the same problems that we usually have for other wallet targets. The size of keypool, wallet encryption, etc... may cause timeout issues. |
Are you still working on it? |
Sorry I've been quite busy, I can close this PR and leave it up for grabs since I havent had a chance to make much progress lately |
This change adds a new fuzz target
wallet_rpc
,this change was suggested in #29901
This change use some of the functionality of the fuzz target
rpc
to also target the wallet rpc's