Skip to content

Fix Merkle proofs for unpaired nodes, Bloom sizing, GZIP trailer - #19

Merged
rickhohler merged 1 commit into
mainfrom
fix/algorithm-edge-cases
Oct 25, 2026
Merged

rickhohler merged 1 commit into
mainfrom
fix/algorithm-edge-cases

Conversation

@rickhohler

Copy link
Copy Markdown
Collaborator

fix-algorithm-edge-cases (DesignAlgorithmsKit-Specs).

  • generateProof adds the node's own hash as sibling for an unpaired node,
    so proofs verify for every leaf of odd trees (roots unchanged)
  • Bloom filters clamp capacity (>= 1) and rate (open interval 0..1) instead
    of trapping; Int.bloomHash uses the bit pattern for negative values
  • Gzip.decompress checks the CRC-32 and ISIZE trailer and reads XLEN
    little-endian; accepts Data slices

Tests: swift test passes 355 tests (343 before + 12 new). Against the old sources the new tests fail: Merkle proofs for blocks 2/3, 4/5, 4/6, 5/6 and 6/7; GZIP corrupt CRC and ISIZE; the negative Int traps.

🤖 Generated with Claude Code

fix-algorithm-edge-cases (DesignAlgorithmsKit-Specs).
- generateProof adds the node's own hash as sibling for an unpaired node,
  so proofs verify for every leaf of odd trees (roots unchanged)
- Bloom filters clamp capacity (>= 1) and rate (open interval 0..1) instead
  of trapping; Int.bloomHash uses the bit pattern for negative values
- Gzip.decompress checks the CRC-32 and ISIZE trailer and reads XLEN
  little-endian; accepts Data slices

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rickhohler
rickhohler merged commit 80bb8f7 into main Oct 25, 2026
1 check passed
@rickhohler
rickhohler deleted the fix/algorithm-edge-cases branch October 25, 2026 00:39
@rickhohler rickhohler mentioned this pull request Oct 25, 2026
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