Skip to content

Conversation

@michaelsproul
Copy link
Member

@michaelsproul michaelsproul commented Jun 24, 2025

Some gnarly type hacking towards merkle-proof support with generalised indices.

Working:

  • Type-safe access of container fields (see Resolve)
  • Conversion from type-safe field types to field positions (indices) and gindices
  • Field resolution for vec/list-like types. See: Preliminary gindex support ssz_types#49.

TODO:

  • Can we convert a gindex back into a type? (probably not lol).
  • Code for producing merkle proofs using gindices.
  • Derive macro for all of the above

Something we probably need for structs is caching, where we add an extra field (maybe using the derive) to contain the tree hash cache:

struct BeaconState {
   slot: Slot,
   validators: List<Validator, ...>,
   ...
   hash_cache: HashCache</* Insert dank type magic to allow typesafe access? */>,
}

@codecov
Copy link

codecov bot commented Jun 25, 2025

Codecov Report

Attention: Patch coverage is 0% with 14 lines in your changes missing coverage. Please review.

Project coverage is 82.05%. Comparing base (55dc5f5) to head (f9f9505).

Files with missing lines Patch % Lines
tree_hash/src/prototype.rs 0.00% 14 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #35      +/-   ##
==========================================
- Coverage   85.57%   82.05%   -3.52%     
==========================================
  Files           6        7       +1     
  Lines         298      312      +14     
==========================================
+ Hits          255      256       +1     
- Misses         43       56      +13     

☔ 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

None yet

Development

Successfully merging this pull request may close these issues.

2 participants