Skip to content

Commit

Permalink
Feat/integrate bridge with chunk verifier (BitVM#226)
Browse files Browse the repository at this point in the history
* init: integration function

* chore: test apis for disprove invalid proof
  • Loading branch information
manishbista28 authored Feb 26, 2025
1 parent 58f539f commit 3f7d91e
Show file tree
Hide file tree
Showing 25 changed files with 484 additions and 253 deletions.
10 changes: 8 additions & 2 deletions bitvm/src/bn254/fq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,10 +412,9 @@ fp_lc_mul!(Mul4LC, 3, 3, [true, true, true, true]);

#[cfg(test)]
mod test {
use crate::bn254::fp254impl::Fp254Impl;
use crate::{bn254::fp254impl::Fp254Impl, ExecuteInfo};
use crate::bn254::fq::Fq;
use crate::treepp::*;
use crate::chunker::common::extract_witness_from_stack;
use ark_ff::Field;
use ark_std::UniformRand;
use ark_ff::AdditiveGroup;
Expand All @@ -426,6 +425,13 @@ mod test {
use rand_chacha::ChaCha20Rng;
use super::*;

fn extract_witness_from_stack(res: ExecuteInfo) -> Vec<Vec<u8>> {
res.final_stack.0.iter_str().fold(vec![], |mut vector, x| {
vector.push(x);
vector
})
}

#[test]
fn test_read_from_stack() {
let _m = BigUint::from_str_radix(Fq::MODULUS, 16).unwrap();
Expand Down
10 changes: 8 additions & 2 deletions bitvm/src/bn254/g1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -946,8 +946,7 @@ mod test {
use crate::bn254::fq::Fq;
use crate::bn254::fr::Fr;

use crate::chunker::common::extract_witness_from_stack;
use crate::{execute_script_without_stack_limit, treepp::*};
use crate::{execute_script_without_stack_limit, treepp::*, ExecuteInfo};
use super::*;
use ark_ec::CurveGroup;
use ark_ff::Field;
Expand All @@ -957,6 +956,13 @@ mod test {
use rand::SeedableRng;
use rand_chacha::ChaCha20Rng;

fn extract_witness_from_stack(res: ExecuteInfo) -> Vec<Vec<u8>> {
res.final_stack.0.iter_str().fold(vec![], |mut vector, x| {
vector.push(x);
vector
})
}

#[test]
fn test_read_from_stack() {
let mut prng = ChaCha20Rng::seed_from_u64(0);
Expand Down
10 changes: 8 additions & 2 deletions bitvm/src/bn254/g2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -763,15 +763,21 @@ mod test {
use crate::bn254::g2::G2Affine;
use crate::bn254::fq::Fq;
use crate::bn254::fq2::Fq2;
use crate::chunker::common::extract_witness_from_stack;
use crate::treepp::*;
use crate::{treepp::*, ExecuteInfo};
use super::*;
use ark_std::UniformRand;
use rand::SeedableRng;
use rand_chacha::ChaCha20Rng;
use ark_ff::AdditiveGroup;
use num_traits::One;

fn extract_witness_from_stack(res: ExecuteInfo) -> Vec<Vec<u8>> {
res.final_stack.0.iter_str().fold(vec![], |mut vector, x| {
vector.push(x);
vector
})
}

#[test]
fn test_read_from_stack() {
let mut prng = ChaCha20Rng::seed_from_u64(0);
Expand Down
Loading

0 comments on commit 3f7d91e

Please sign in to comment.