Skip to content

feat: add fuzzing infrastructure and tests#864

Open
a1denvalu3 wants to merge 12 commits intocashubtc:mainfrom
a1denvalu3:feat/fuzzing
Open

feat: add fuzzing infrastructure and tests#864
a1denvalu3 wants to merge 12 commits intocashubtc:mainfrom
a1denvalu3:feat/fuzzing

Conversation

@a1denvalu3
Copy link
Collaborator

@a1denvalu3 a1denvalu3 commented Jan 8, 2026

Summary

Introduces property-based fuzz testing using hypothesis to improve the robustness of core data models and the Mint API. This ensures data integrity during serialization and verifies that the API handles unexpected inputs gracefully without crashing.

Changes

  • Core Fuzzing (tests/fuzz/test_fuzz_core.py):

    • Implements round-trip serialization/deserialization tests for Secret, BlindedMessage, Proof, MintQuote, MeltQuote, and Keyset models.
    • Verifies model invariants and state consistency (e.g., a quote cannot be both 'paid' and 'pending').
    • Tests TokenV3 to TokenV4 conversion integrity.
  • API Fuzzing (tests/fuzz/test_fuzz_mint_api.py):

    • Adds fuzz tests for critical Mint endpoints: /mint, /melt, /swap, /checkstate, /restore.
    • Validates that the server handles malformed, random, or boundary-case inputs gracefully without crashing (500 Internal Server Error).
    • Asserts that response status codes are within expected handled ranges (200, 400, 404, 422, 503).

@ye0man ye0man added this to nutshell Jan 21, 2026
@github-project-automation github-project-automation bot moved this to Backlog in nutshell Jan 21, 2026
@codecov
Copy link

codecov bot commented Jan 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.52%. Comparing base (516cee2) to head (ee12d6a).
⚠️ Report is 18 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #864      +/-   ##
==========================================
- Coverage   64.71%   61.52%   -3.20%     
==========================================
  Files          91       90       -1     
  Lines       10900    10838      -62     
==========================================
- Hits         7054     6668     -386     
- Misses       3846     4170     +324     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

3 participants