fuzz: Rework rpc fuzz target - #35860
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/35860. ReviewsSee the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste |
facb28a to
888849d
Compare
|
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
faecf69 to
0000d72
Compare
0000d72 to
fa895bb
Compare
The
rpcfuzz target constructs a vector of string args and passes that toRPCConvertValues.This has many issues:
range argumentor viaConsumeArrayRPCArgument. However, those strings may not be converted to an array viaRPCConvertValuesand just be passed on as string argument. Having a call toConsumeArrayRPCArgumentthat ends up with a plain json string is confusing.RPCConvertValues. Having a call toConsumeScalarRPCArgumentthat was intended to give a raw string but ends up with a arbitrary json object is confusing.Fix those "stringly-typed" issues by making the fuzz target "type safe":
ConsumeScalarRPCArgumenttoConsumeBasicRPCArgumentand return a properUniValuefrom it.ConsumeRPCArgumentis changed to cover both json arrays and json dicts properly.RPCConvertValues.Making the fuzz target "type safe" is also the first step in making it schema-aware.