Skip to content

Conversation

michaelsproul
Copy link
Member

Define a new TreeHashMut trait which takes &mut self

This might be a cleaner alternative to:

Although we got bogged down in the Milhouse changes, especially around supporting nested lists: List<List<u64, N>, M> is troublesome because the T in List<T> should probably implement TreeHashMut, but we don't have mutable access to the elements of an immutable list.

Another alternative might be to embrace interior mutability in Milhouse so that TreeHash can be implemented without mutation altogether.

Copy link

codecov bot commented Sep 27, 2024

Codecov Report

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

Project coverage is 78.14%. Comparing base (12d828c) to head (6ea7d0f).

Files with missing lines Patch % Lines
tree_hash/src/lib.rs 0.00% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #24      +/-   ##
==========================================
- Coverage   79.66%   78.14%   -1.52%     
==========================================
  Files           6        6              
  Lines         295      302       +7     
==========================================
+ Hits          235      236       +1     
- Misses         60       66       +6     

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

@michaelsproul
Copy link
Member Author

Idea: for nested lists we could exploit copy-on-write and just take a mutable copy of the inner list when tree hashing 🤔. It would get copied, mutated and then reinserted

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