Skip to content

Add comprehensive BIP-93 test suite - #1

Open
benjamin-jarvie wants to merge 3 commits into
FractalEncrypt:masterfrom
benjamin-jarvie:add-bip93-test-suite
Open

Add comprehensive BIP-93 test suite#1
benjamin-jarvie wants to merge 3 commits into
FractalEncrypt:masterfrom
benjamin-jarvie:add-bip93-test-suite

Conversation

@benjamin-jarvie

Copy link
Copy Markdown

Summary

  • Adds test coverage for share recovery (2-of-n and 3-of-n using BIP-93 test vectors)
  • Adds input validation tests (checksum, length, empty input, sanitization)
  • Adds BIP-93 invalid test vector rejection tests
  • All tests use plain Python asserts with no external dependencies

Test files

  • test_share_recovery.py - Tests Lagrange interpolation recovers correct S-share and seed
  • test_validation.py - Tests edge cases and error handling
  • test_invalid_vectors.py - Tests that malformed/invalid codex32 strings are rejected

How to run

cd codex32_terminal
source venv/bin/activate
python tests/test_share_recovery.py
python tests/test_validation.py
python tests/test_invalid_vectors.py

All tests pass against current master.

Tests for codex32 share parsing and validation:
- test_share_recovery.py: 2-of-n and 3-of-n recovery with BIP-93 vectors
- test_validation.py: Input validation (checksum, length, empty, sanitization)
- test_invalid_vectors.py: BIP-93 invalid test vectors rejection

Also updates README with:
- How to run tests (macOS/Linux/Windows)
- Expected test output
- Cross-platform setup instructions
- Test file descriptions in codebase overview

All tests use plain asserts with no external dependencies.
kiwihodl and others added 2 commits February 1, 2026 11:24
- test_validation.py: Add 4 new edge case tests
  - test_invalid_bech32_characters_rejected
  - test_mixed_case_rejected
  - test_none_input_returns_empty_error
  - test_wrong_hrp_rejected

- test_share_recovery.py: Add 5 new edge case tests
  - test_duplicate_share_rejected
  - test_empty_share_list_rejected
  - test_insufficient_shares_rejected
  - test_mismatched_identifiers_rejected
  - test_extra_shares_still_works (skip placeholder)

- Add .gitignore for Python artifacts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove unused codex32_to_seed_bytes import from test_validation.py
- Move Codex32InputError import to module level in test_share_recovery.py
- Replace skip placeholder with real test_exact_threshold_shares_works
- Add comments explaining corruption test positions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant