fuzz: test non-max descriptor satisfaction weight
What changed, and why it matters
This commit is a small fuzz-test improvement. It fixes an obvious test bug where the same function was being called twice with the same argument, and instead calls it with both possible arguments, then adds assertions about the results. It does not change any production wallet, consensus, or networking code, and there is no security fix or vulnerability indicated.
No security action required. Treat as normal test-quality improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
In src/test/fuzz/descriptor_parse.cpp, the fuzz harness previously called Descriptor::MaxSatisfactionWeight(true) twice and stored both results under misleading names (max_sat_maxsig and max_sat_nonmaxsig). The commit changes the second call to MaxSatisfactionWeight(false) and adds two asserts: (1) availability of the estimate must not depend on the signature-size assumption, and (2) assuming non-max-size signatures must never increase the estimate. This is purely a test/fuzzing correctness enhancement.
Changed components
src/test/fuzz/descriptor_parse.cppInspect captured patch +5 / −1
diff --git a/src/test/fuzz/descriptor_parse.cpp b/src/test/fuzz/descriptor_parse.cpp
index 6b3084e2..2e73cfcc 100644
--- a/src/test/fuzz/descriptor_parse.cpp
+++ b/src/test/fuzz/descriptor_parse.cpp
@@ -55,7 +55,11 @@ static void TestDescriptor(const Descriptor& desc, FlatSigningProvider& sig_prov
}
const auto max_sat_maxsig{desc.MaxSatisfactionWeight(true)};
- const auto max_sat_nonmaxsig{desc.MaxSatisfactionWeight(true)};
+ const auto max_sat_nonmaxsig{desc.MaxSatisfactionWeight(false)};
+ // Whether an estimate is available must not depend on the signature-size
+ // assumption, and assuming non-max-size signatures must never increase it.
+ assert(max_sat_maxsig.has_value() == max_sat_nonmaxsig.has_value());
+ assert(max_sat_nonmaxsig <= max_sat_maxsig);
const auto max_elems{desc.MaxSatisfactionElems()};
// We must be able to estimate the max satisfaction size for any solvable descriptor (but combo).
const bool is_nontop_or_nonsolvable{!*is_solvable || !desc.GetOutputType()};
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.