Commit graph

429 commits

Author SHA1 Message Date
7d93755d71 smt: add build_subtrees() to coordinate subtree building 2024-11-13 13:34:28 -07:00
6497f1251c add a parallel construction benchmark to src/main.rs 2024-11-13 13:34:28 -07:00
64f4e51ad1 improve docs for build_subtree() 2024-11-13 13:34:28 -07:00
c4fbc25e76 smt: add from_raw_parts() to trait interface 2024-11-13 13:34:28 -07:00
156ed308cc implement test_multithreaded_subtree 2024-11-13 13:34:28 -07:00
32e1fc4552 convert test_singlethreaded_subtree to use SubtreeLeavesIter 2024-11-13 13:34:28 -07:00
e8684b67c8 smt: make with_entries() a trait method 2024-11-13 13:34:28 -07:00
6e7a6caf17 SubtreeLeaf::from_smt_leaf() was only used in tests 2024-11-13 13:34:28 -07:00
525cbf930a cleanup test_singlethreaded_subtrees a bit 2024-11-13 13:34:28 -07:00
905a3856f7 add SubtreeLeavesIter 2024-11-13 13:34:28 -07:00
be53dd317a factor out subtree-append logic 2024-11-13 13:34:28 -07:00
bfa4bb493b rename PrecomputedSubtrees -> PairComputations 2024-11-13 13:34:28 -07:00
3ba8ba9bba make PrecomputedSubtrees more generic 2024-11-13 13:34:28 -07:00
be028fa0f5 working test_singlethreaded_subtrees() 2024-11-13 13:34:28 -07:00
7b5da91b82 refactor sorted_pairs_to_leaves() to also group subtrees 2024-11-13 13:34:28 -07:00
3abb959048 add test_two_subtrees() test 2024-11-13 13:34:28 -07:00
10be4141e8 merkle: add a benchmark for constructing 256-leaf balanced trees 2024-11-13 13:34:28 -07:00
053b77ab26 refactor test_build_subtree_from_leaves() 2024-11-13 13:34:28 -07:00
2dc6de41fb WIP(smt): impl simple subtree8 hashing and benchmarks for it
bench(smt-subtree): add a benchmark for single-leaf subtrees

make build_subtree also return the next leaf row

convert (col, hash) tuples to a dedicated struct
2024-11-13 13:34:28 -07:00
491affdc69 add sorted_pairs_to_leaves() and test for it 2024-11-13 13:34:23 -07:00
b954bb5287 smt: add pairs_to_leaf() to trait 2024-11-13 13:29:48 -07:00
8e594963d2 merkle: add parent() helper function on NodeIndex 2024-11-04 16:17:58 -07:00
Bobbin Threadbare
ee20a49953
chore: increment crate version to v0.12.0 and update changelog 2024-10-30 15:04:08 -07:00
Al-Kindi-0
0d75e3593b
chore: migrate to Winterfell v0.10.0 release (#338) 2024-10-29 15:02:46 -07:00
Bobbin Threadbare
689cc93ed1
chore: update crate version to v0.11.0 and set MSRV to 1.82 2024-10-17 23:16:41 -07:00
Bobbin Threadbare
7970d3a736
Merge branch 'main' into next 2024-10-17 20:53:09 -07:00
Al-Kindi-0
a734dace1e
feat: update RPO's padding rule to use that in the xHash paper (#318) 2024-10-17 20:49:44 -07:00
Andrey Khmuro
940cc04670
feat: add Smt::is_empty (#337) 2024-10-17 14:27:50 -07:00
Andrey Khmuro
e82baa35bb
feat: return error instead of panic during MMR verification (#335) 2024-10-17 07:23:29 -07:00
Bobbin Threadbare
876d1bf97a
chore: update crate version v0.10.3 2024-09-26 09:37:34 -07:00
Philipp Gackstatter
8adc0ab418
feat: implement get_size_hint for Smt (#331) 2024-09-26 09:13:50 -07:00
Bobbin Threadbare
c2eb38c236
chore: increment crate version to v0.10.2 2024-09-25 03:05:33 -07:00
Philipp Gackstatter
a924ac6b81
feat: Add size hint for digests (#330) 2024-09-25 03:03:31 -07:00
Bobbin Threadbare
e214608c85
fix: bug introduced due to merging 2024-09-13 11:10:34 -07:00
Bobbin Threadbare
c44ccd9dec
Merge branch 'main' into next 2024-09-13 11:01:04 -07:00
Bobbin Threadbare
e34900c7d8
chore: update version to v0.10.1 2024-09-13 10:58:06 -07:00
Santiago Pittella
2b184cd4ca
feat: add de/serialization to InOrderIndex and PartialMmr (#329) 2024-09-13 08:47:46 -07:00
Bobbin Threadbare
913384600d
chore: fix typos 2024-09-11 16:52:21 -07:00
Qyriad
ae807a47ae
feat: implement transactional Smt insertion (#327)
* feat(smt): impl constructing leaves that don't yet exist

This commit implements 'prospective leaf construction' -- computing
sparse Merkle tree leaves for a key-value insertion without actually
performing that insertion.

For SimpleSmt, this is trivial, since the leaf type is simply the value
being inserted.

For the full Smt, the new leaf payload depends on the existing payload
in that leaf. Since almost all leaves are very small, we can just clone
the leaf and modify a copy.

This will allow us to perform more general prospective changes on Merkle
trees.

* feat(smt): export get_value() in the trait

* feat(smt): implement generic prospective insertions

This commit adds two methods to SparseMerkleTree: compute_mutations()
and apply_mutations(), which respectively create and consume a new
MutationSet type. This type represents as set of changes to a
SparseMerkleTree that haven't happened yet, and can be queried on to
ensure a set of insertions result in the correct tree root before
finalizing and committing the mutation.

This is a direct step towards issue 222, and will directly enable
removing Merkle tree clones in miden-node InnerState::apply_block().

As part of this change, SparseMerkleTree now requires its Key to be Ord
and its Leaf to be Clone (both bounds which were already met by existing
implementations). The Ord bound could instead be changed to Eq + Hash,
if MutationSet were changed to use a HashMap instead of a BTreeMap.

* chore(smt): refactor empty node construction to helper function
2024-09-11 16:49:57 -07:00
Paul-Henry Kajfasz
f4a9d5b027
Merge pull request #323 from 0xPolygonMiden/phklive-consistent-ci
Update `Makefile` and `CI`
2024-08-22 08:22:20 -07:00
Paul-Henry Kajfasz
ee42d87121
Replace i. by 1. 2024-08-22 16:14:19 +01:00
Paul-Henry Kajfasz
b1cb2b6ec3
Fix comments 2024-08-22 15:21:59 +01:00
Paul-Henry Kajfasz
e4a9a2ac00
Updated test in workflow 2024-08-21 16:53:28 +01:00
Paul-Henry Kajfasz
c5077b1683
updated readme 2024-08-21 14:18:41 +01:00
Paul-Henry Kajfasz
2e74028fd4
Updated makefile 2024-08-21 14:11:17 +01:00
Paul-Henry Kajfasz
8bf6ef890d
fmt 2024-08-21 14:04:23 +01:00
Paul-Henry Kajfasz
e2aeb25e01
Updated doc comments 2024-08-21 14:03:43 +01:00
Paul-Henry Kajfasz
790846cc73
Merge next 2024-08-21 09:29:39 +01:00
Paul-Henry Kajfasz
4cb6bed428
Updated changelog + added release to no-std 2024-08-19 14:37:58 +01:00
Bobbin Threadbare
a12e62ff22
feat: improve MMR api (#324) 2024-08-18 09:35:12 -07:00