Skip to content

Commit

Permalink
Use e2e tests for stump accumulator
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kus committed Jan 5, 2025
1 parent bdacade commit 028589f
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 1,070 deletions.
2 changes: 0 additions & 2 deletions packages/utreexo/src/lib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ pub mod stump {
pub mod accumulator;
pub mod proof;
pub mod state;
#[cfg(test)]
mod accumulator_tests;
}
pub mod vanilla {
pub mod accumulator;
Expand Down
30 changes: 0 additions & 30 deletions packages/utreexo/src/stump/accumulator.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -114,34 +114,4 @@ pub impl StumpUtreexoAccumulatorImpl of StumpUtreexoAccumulator {

Result::Ok(UtreexoStumpState { roots: new_roots.span(), num_leaves: *self.num_leaves })
}

/// Legacy implementation of proof verification.
fn verify_legacy(
self: @UtreexoStumpState, proof: @UtreexoBatchProof, del_hashes: Span<felt252>,
) -> Result<(), ByteArray> {
let computed_roots: Span<felt252> = proof
.compute_roots_legacy(del_hashes, *self.num_leaves)?;
let mut number_matched_roots: u32 = 0;

for i in 0..computed_roots.len() {
for root in *self.roots {
match root {
Option::Some(root) => {
if (computed_roots[i] == root) {
number_matched_roots += 1;
};
},
Option::None => {},
};
};
};

let computed_roots_len = computed_roots.len();

if (computed_roots_len != number_matched_roots && computed_roots_len != 0) {
return Result::Err("Proof verification failed");
}

Result::Ok(())
}
}
Loading

0 comments on commit 028589f

Please sign in to comment.