Skip to content

[wip] Merkle Tree verification#10

Draft
LindaGuiga wants to merge 8 commits intomainfrom
linda/merkle-tree
Draft

[wip] Merkle Tree verification#10
LindaGuiga wants to merge 8 commits intomainfrom
linda/merkle-tree

Conversation

@LindaGuiga
Copy link
Copy Markdown

This verifies verify_batch for Merkle trees. There are quite a few interactions with the public inputs and the FRI table, which can't be implemented yet.

// `DIGEST_ELEMS` is the number of digest elements of the hash. `MAX_TREE_HEIGHT` is the maximal tree height that can be handled by the AIR.
pub struct MerkleTreeAir<F, C, const DIGEST_ELEMS: usize, const MAX_TREE_HEIGHT: usize>
where
F: PrimeField64,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need PrimeField64 and not only PrimeField?

.assert_zero(local.length.clone() - next.length.clone());

let mut cur_to_hash = vec![AB::Expr::ZERO; 2 * DIGEST_ELEMS];
for i in 0..DIGEST_ELEMS {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for i in 0..DIGEST_ELEMS {
// Hash either (local.sibiling, local.state) or (local.state, local.sibling) depending on the current index bit
for i in 0..DIGEST_ELEMS {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants