Skip to content

Add tests for #[derive(TreeHash)] - #48

Merged
michaelsproul merged 3 commits into
sigp:mainfrom
eserilev:derive-struct-tests
Jul 27, 2026
Merged

Add tests for #[derive(TreeHash)]#48
michaelsproul merged 3 commits into
sigp:mainfrom
eserilev:derive-struct-tests

Conversation

@eserilev

Copy link
Copy Markdown
Member

Add tests for #[derive(TreeHash)] so that any future macro code generation bugs are caught in CI

Written by claude, reviewed by me

@michaelsproul michaelsproul left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! 🔥

@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.57%. Comparing base (6cbb79e) to head (67f2aed).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #48      +/-   ##
==========================================
+ Coverage   90.70%   91.57%   +0.86%     
==========================================
  Files           7        7              
  Lines         409      463      +54     
==========================================
+ Hits          371      424      +53     
- Misses         38       39       +1     

☔ View full report in Codecov by Harness.
📢 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.

@michaelsproul
michaelsproul merged commit adef128 into sigp:main Jul 27, 2026
8 checks passed
eserilev added a commit to eserilev/tree_hash that referenced this pull request Jul 28, 2026
Extend the differential property tests (sigp#47) and derive macro tests (sigp#48)
to cover the new functionality in the progressive branch:

- Property test ProgressiveMerkleHasher against a recursive reference
  implementation of EIP-7916 merkleize_progressive, with random byte
  lengths and random write splits to exercise the partial-chunk carry
  buffer, up to 128 chunks to cross all early level boundaries.
- Property test ProgressiveBitList hashing against the same reference
  with independent bit packing, covering the empty-list workaround.
- Derive tests for progressive containers: skip_hashing interaction,
  nesting (both directions), generics, tree_hash_type, a six-field
  container crossing a progressive level boundary, and active_fields
  spanning multiple bytes.
- Hard-coded roots for the level-crossing and multi-byte cases computed
  independently from the EIP pseudocode, so these tests do not rely on
  the hasher under test.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017PpXigbebk4GAQ9D9qdFzU
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.

2 participants