Add module for generic vector accumulators in common #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a generic module for a "Merkleized vector" data structure, that allows to produce proofs of inclusion, and also to modify an element of the vector, producing a proof of update. While it would be possible to produce accumulators that allow appending elements (therefore changing the length of the vector), that's probably overkill and would add significant complexity - therefore, only modifying existing elements is supported here.
This will be used by both the
vanadium-client-sdk
(the prover holding the outsourced memory), and the VM app (the verifier) in order to handle commit and retrieval of memory pages that the VM outsources to the client.The module is implemented in a generic way, allowing to plug an implementation of a hash function externally (this will allow the VM to use a bolos-accelerated hash function via ecalls, while the client can use what's available natively on the host).
Moreover, I tried to keep it generic, so that accumulators different than plain Merkle trees could be added in the future, while keeping the same interface.
Closes: #4