Commit graph

49 commits

Author SHA1 Message Date
Philipp Gackstatter
a27f9ad828
refactor: use thiserror to derive errors and update error messages (#344) 2024-11-21 15:52:20 -08:00
Paul-Henry Kajfasz
ad0f472708
Updated Makefile and Readme 2024-08-16 15:07:27 -07:00
Paul Schoenfelder
999a64fca6 chore: handle deprecations in winterfell 0.8.3 release 2024-03-17 16:18:23 -04:00
Augusto Hack
dbab0e9aa9
fix: clippy warnings (#280) 2024-02-21 20:55:02 -08:00
Philippe Laferrière
552d90429b Remove TieredSmt (#277) 2024-02-14 11:52:40 -08:00
Philippe Laferrière
1cdd3dbbfa Add methods to Smt necessary for VM tests (#264)
* Smt::inner_nodes

* Add conversion Smt -> MerkleStore

* add docstring to `Smt`

* add to docstring

* fmt

* add `leaves()` method to `Smt`

* add `kv_pairs` functions

* rewrite `into_elements()` in terms of `into_kv_pairs()`

* change docstring
2024-02-14 11:52:40 -08:00
Bobbin Threadbare
a933ff2fa0 refactor: remove obsolete traits 2024-02-14 11:52:40 -08:00
Philippe Laferrière
8ea37904e3 Introduce SparseMerkleTree trait (#245) 2024-02-14 11:52:40 -08:00
Al-Kindi-0
8078021aff feat: Falcon 512 signature 2023-10-03 20:45:18 +02:00
frisitano
1fa2895724 refactor: modify MerkleStore::non_empty_leaves to support TSMT 2023-09-19 16:19:17 +08:00
Andrey Khmuro
2f09410e87 refactor: replace with EMPTY_WORD, ZERO and ONE 2023-08-31 20:36:40 +02:00
Bobbin Threadbare
9f54c82d62 feat: implement additional leaf traversal methods on MerkleStore 2023-08-28 16:50:34 -07:00
Augusto F. Hack
8cf5e9fd2c
feature: add conditional support for serde 2023-08-11 13:59:53 +02:00
Andrey Khmuro
71b04d0734 refactor: replace MerklePathSet with PartialMerkleTree 2023-07-27 22:03:16 +03:00
frisitano
da2d08714d feat: introduce TryApplyDiff and refactor RecordingMap finalizer 2023-07-26 12:14:39 +02:00
frisitano
44e60e7228 feat: introduce diff traits and objects 2023-07-20 16:41:59 +02:00
Bobbin Threadbare
b2d6866d41 refactor: rename Merkle store Node into StoreNode 2023-06-25 01:42:21 -07:00
Bobbin Threadbare
f08644e4df refactor: simplify recording MerkleStore structure 2023-06-23 23:19:12 -07:00
frisitano
679a30e02e feat: introduce recorder objects 2023-06-23 14:26:57 +01:00
tohrnii
fe9aa8c28c refactor: refactor crypto APIs to use RpoDigest instead of Word 2023-06-09 21:27:09 +01:00
Bobbin Threadbare
21e7a5c07d feat: implement iterators over contents of TieredSmt 2023-05-20 22:47:07 -07:00
Bobbin Threadbare
629494b601 feat: add leaves() iterator to SimpleSmt 2023-05-11 00:37:16 -07:00
Bobbin Threadbare
13aeda5a27 feat: add subset() to MerkleStore 2023-05-09 18:38:21 -07:00
frisitano
4555fc918f feat: add .inner_nodes() to [MerkleStore] 2023-05-04 19:15:52 +07:00
Bobbin Threadbare
130ae3d12a feat: add inner node iterator to MerklePath 2023-04-21 14:27:58 -07:00
Bobbin Threadbare
9be4253f19 feat: remove clone requirement for MerkleStore From constructors 2023-04-21 11:22:36 -07:00
Augusto F. Hack
59595a2e04
feat: added From convertions for the MerkleStore 2023-04-21 14:47:58 +02:00
Augusto F. Hack
eb316f51bc
store: remove SimpleSMT/MerkleTree/Mmr add/with methods 2023-04-21 14:47:48 +02:00
Augusto F. Hack
8161477d6a
store: support adding existing structures 2023-04-20 13:45:31 +02:00
Augusto F. Hack
3996374a8b
feat: allow merging of leaves
Consider the case of a MMR with one entry, and a new entry is being
added. Both of these values are quite unique, they are at the same time
the root and only leaf of their corresponding tree. Currently this
representation is not supported by the [MerkleStore], so the leaves are
not in it. Once the two values are merged, they both become leaves of a
new tree under the new parent, and the existing validation didn't permit
that promotion from happening.

This lifts the validation, and changes the method to clarify that not
only `root` are being merged, by arbitrary nodes of a tree (leafs,
internal, or roots), with arbitrary mixing of each.
2023-04-17 12:21:51 +02:00
Augusto F. Hack
bbb1e641a3
config: add rustfmt config 2023-04-11 17:38:39 +02:00
Victor Lopez
00ffc1568a
feat: add MerkleStore::get_leaf_depth
This commit introduces `get_leaf_depth`, a tiered SMT helpers that will
retrieve the depth of a leaf for a given root, capped by `64`.

closes #119
2023-04-06 23:01:38 +02:00
Bobbin Threadbare
bd557bc68c fix: add validation to NodeIndex constructor and remove BitIterator 2023-04-05 12:08:00 -07:00
Augusto Hack
cf94ac07b7
Merge pull request #121 from 0xPolygonMiden/hacka-simple-smt-parent-node-iterator
feat: add parent node iterator for SimpleSMT
2023-04-05 00:46:32 +02:00
Augusto F. Hack
9275dd00ad
feat: add parent node iterator for SimpleSMT 2023-04-04 22:33:26 +02:00
Augusto F. Hack
429d3bab6f
feat: add support for MMR to the MerkleStore 2023-04-04 22:33:01 +02:00
Augusto F. Hack
1df4318399
feat: add node iterator to MerkleTree 2023-04-04 22:11:21 +02:00
Augusto F. Hack
f8a62dae76
chore: remove simple_smt::Store 2023-03-31 03:10:01 +02:00
Victor Lopez
d37f3f5e84
feat: Add depth as store SMT argument
Prior to this commit, MerkleStore allowed the creation of Sparse Merkle
tree only with the maximum depth of 63. However, this doesn't fit the
Tiered Sparse Merkle tree requirements, as it will contain trees of
depth 16.

This commit adds the `depth` argument to the MerkleStore methods that
will create Sparse Merkle trees.
2023-03-30 01:13:05 +02:00
Augusto Hack
75af3d474b
Merge pull request #113 from 0xPolygonMiden/hacka-merkle-store-fix-empty-roots
bugfix: fix internal nodes of for empty leafs of a SMT
2023-03-24 23:26:48 +01:00
Augusto F. Hack
9e6c8ff700
bugfix: fix internal nodes of for empty leafs of a SMT
The path returned by `EmptySubtreeRoots` starts at the root, and goes to
the leaf. The MerkleStore constructor assumed the other direction, so
the parent/child hashes were reversed.

This fixes the bug and adds a test.
2023-03-24 23:22:31 +01:00
Augusto F. Hack
7957cc929a
feat: added MerkleStore serde 2023-03-24 21:44:36 +01:00
Bobbin Threadbare
ce38ee388d
Merge pull request #104 from 0xPolygonMiden/hacka-store-docs
Store docs
2023-03-23 13:11:04 -07:00
Augusto F. Hack
2d1bc3ba34
store: added user documentation on usage and purpose 2023-03-23 14:19:37 +01:00
Bobbin Threadbare
9531d2bd34 fix: to paths reduction of MerklePathSet 2023-03-23 01:12:02 -07:00
Augusto F. Hack
b250752883
store: added with_merkle_paths constructor
And unit tests for each constructor type.
2023-03-22 14:17:12 +01:00
Victor Lopez
84086bdb95
feat: add merkle path containers and return them on tree update
Returning tuples is often confusing as they don't convey meaning and it
should be used only when there is no possible ambiguity.

For `MerkleStore`, we had a couple of tuples being returned, and reading
the implementation was required in order to distinguish if they were
leaf values or computed roots.

This commit introduces two containers that will self-document these
returns: `RootPath` and `ValuePath`. It will also update `set_node` to
return both the new root & the new path, so we can prevent duplicated
traversals downstream when updating a node (one to update, the second to
fetch the new path/root).
2023-03-21 20:45:01 +01:00
Augusto F. Hack
17eb8d78d3 chore: storage -> store 2023-03-21 09:45:36 +01:00
Victor Lopez
8cb245dc1f
bugfix: reverse merkle path to match other structures
The store builds the path from root to leaf, this updates the code to
return a path from leaf to root, as it is done by the other structures.

This also added custom error for missing root.
2023-03-21 09:45:29 +01:00
Renamed from src/merkle/store.rs (Browse further)