Commit graph

917 commits

Author SHA1 Message Date
Grzegorz Świrski
00eea2516f use Cow instead of the additional IntoIter struct 2025-04-24 13:16:21 +02:00
Grzegorz Świrski
c236589b5e loop over depths in tests 2025-04-24 13:16:21 +02:00
Grzegorz Świrski
c60967a21a clarify empty_nodes_mask documentation 2025-04-24 13:16:21 +02:00
Grzegorz Świrski
9b9f454a7c clarify that SparseMerklePath can store up to SMT_MAX_DEPTH nodes total 2025-04-24 13:16:21 +02:00
Grzegorz Świrski
d95d719530 remove unsafe FromIterator<(NonZero<u8>, Option<RpoDigest>)> 2025-04-24 13:16:21 +02:00
Grzegorz Świrski
1aee55779c make from_iter_with_depth private, make sure iterators in tests have the same length 2025-04-24 13:16:21 +02:00
Grzegorz Świrski
97e81bc39b keep at_depth and at_idx consistent wrt ownership 2025-04-24 13:16:21 +02:00
Grzegorz Świrski
a988fb2c8c move comment 2025-04-24 13:16:21 +02:00
Grzegorz Świrski
c9ad4e570d return a deserialization error if too many empty nodes detected 2025-04-24 13:16:21 +02:00
Grzegorz Świrski
68f0b2c9b2 move try_from doc to function level for better ide support 2025-04-24 13:16:21 +02:00
Grzegorz Świrski
b28a31f495 clearer assertions in sparse_path tests 2025-04-24 13:16:21 +02:00
Grzegorz Świrski
ff75b046a6 swap test_borrowing_iterator and test_owning_iterator names 2025-04-24 13:16:21 +02:00
29e21a34ca smt: change SimpleSmt::open() to return a sparse path 2025-04-24 13:16:21 +02:00
d633acdd5b SimpleSmt: do not assume that Merkle paths Deref to Vec in tests
This is in preparation for the next commit, where we change
`SimpleSmt::open()` to return a `SparseMerklePath`, which cannot
dereference to a Vec.
2025-04-24 13:16:21 +02:00
3364e59471 smt: add SparseMerklePath, a compact representation of MerklePath
Co-authored-by: Philipp Gackstatter <PhilippGackstatter@users.noreply.github.com>
2025-04-24 13:16:21 +02:00
11af2ad57b squash 'strengthen wording in docs' into 'document indexing order of nodes 2025-04-24 13:14:42 +02:00
e514aa272a MerklePath: document indexing order of nodes
I've left the iteration order of `MerklePath::inner_nodes()`
unspecified, but other methods of iteration and indexing are now
specified to be in order of deepest to shallowest.

Co-authored-by: Philipp Gackstatter <PhilippGackstatter@users.noreply.github.com>
2025-04-24 13:14:00 +02:00
e56c386f8e MerklePath: add clarity getters for API parity with future SparseMerklePath
This adds `MerklePath::at_depth()` and `MerklePath::at_idx()`, both for
clarity and for API parity with `SparseMerklePath` in the next commit.
2025-04-24 13:14:00 +02:00
Grzegorz Świrski
4cfd0bccd4 use Cow instead of the additional IntoIter struct 2025-04-24 13:14:00 +02:00
Grzegorz Świrski
4ad55debbf loop over depths in tests 2025-04-24 13:14:00 +02:00
Grzegorz Świrski
3d0160cb09 clarify empty_nodes_mask documentation 2025-04-24 13:14:00 +02:00
Grzegorz Świrski
89e93e5a98 clarify that SparseMerklePath can store up to SMT_MAX_DEPTH nodes total 2025-04-24 13:14:00 +02:00
Grzegorz Świrski
56c00da446 remove unsafe FromIterator<(NonZero<u8>, Option<RpoDigest>)> 2025-04-24 13:14:00 +02:00
Grzegorz Świrski
afbda48d54 make from_iter_with_depth private, make sure iterators in tests have the same length 2025-04-24 13:14:00 +02:00
Grzegorz Świrski
ec6d5de741 keep at_depth and at_idx consistent wrt ownership 2025-04-24 13:14:00 +02:00
Grzegorz Świrski
6d53c446f4 move comment 2025-04-24 13:14:00 +02:00
Grzegorz Świrski
e89884b0ed return a deserialization error if too many empty nodes detected 2025-04-24 13:14:00 +02:00
Grzegorz Świrski
6cb2716fb6 move try_from doc to function level for better ide support 2025-04-24 13:14:00 +02:00
Grzegorz Świrski
8371347aec clearer assertions in sparse_path tests 2025-04-24 13:14:00 +02:00
Grzegorz Świrski
28ef569260 swap test_borrowing_iterator and test_owning_iterator names 2025-04-24 13:14:00 +02:00
Grzegorz Świrski
7c5f8b3723 expect instead of unwrap
Co-authored-by: Philipp Gackstatter <PhilippGackstatter@users.noreply.github.com>
2025-04-24 13:14:00 +02:00
cc67a602be smt: change SimpleSmt::open() to return a sparse path 2025-04-24 13:14:00 +02:00
b43a852578 SimpleSmt: do not assume that Merkle paths Deref to Vec in tests
This is in preparation for the next commit, where we change
`SimpleSmt::open()` to return a `SparseMerklePath`, which cannot
dereference to a Vec.
2025-04-24 13:14:00 +02:00
116ec286be smt: add SparseMerklePath, a compact representation of MerklePath 2025-04-24 13:14:00 +02:00
610c773924 partially migrate get_hash -> get_node_hash 2025-04-24 13:13:56 +02:00
Grzegorz Świrski
c5676aed3e use Cow instead of the additional IntoIter struct 2025-04-24 12:53:38 +02:00
Grzegorz Świrski
21393fc45b loop over depths in tests 2025-04-24 12:53:38 +02:00
Grzegorz Świrski
115f10cfc7 clarify empty_nodes_mask documentation 2025-04-24 12:53:38 +02:00
Grzegorz Świrski
1c842f3bab clarify that SparseMerklePath can store up to SMT_MAX_DEPTH nodes total 2025-04-24 12:53:38 +02:00
Grzegorz Świrski
e4d58c6531 remove unsafe FromIterator<(NonZero<u8>, Option<RpoDigest>)> 2025-04-24 12:53:38 +02:00
Grzegorz Świrski
cdac2d3ade make from_iter_with_depth private, make sure iterators in tests have the same length 2025-04-24 12:53:38 +02:00
Grzegorz Świrski
10557ea9e2 keep at_depth and at_idx consistent wrt ownership 2025-04-24 12:53:38 +02:00
Grzegorz Świrski
1c4eb748bd move comment 2025-04-24 12:53:38 +02:00
Grzegorz Świrski
85fc20900c return a deserialization error if too many empty nodes detected 2025-04-24 12:53:38 +02:00
Grzegorz Świrski
5c12e480df move try_from doc to function level for better ide support 2025-04-24 12:53:38 +02:00
Grzegorz Świrski
8e18827c20 clearer assertions in sparse_path tests 2025-04-24 12:53:38 +02:00
Grzegorz Świrski
f7ece78015 swap test_borrowing_iterator and test_owning_iterator names 2025-04-24 12:53:38 +02:00
Grzegorz Świrski
8e2ffb5e2a expect instead of unwrap
Co-authored-by: Philipp Gackstatter <PhilippGackstatter@users.noreply.github.com>
2025-04-24 12:53:38 +02:00
Grzegorz Świrski
b77bc65b18 strengthen the wording in docs
Co-authored-by: Philipp Gackstatter <PhilippGackstatter@users.noreply.github.com>
2025-04-24 12:53:38 +02:00
56a94c1a8b smt: change SimpleSmt::open() to return a sparse path 2025-04-24 12:53:38 +02:00